Flash focus in Firefox and chrome
Recently i encountered a problem which was hard finding a solution in the internet: setting the focus to the flash object in firefox and chrome when loading the website.
I tried using this idea:
but while this works in IE it's not working in firefox at all.
I also tried detecting the browser and focusing the embed instead of the object in firefox, but turns out that the embed can't take focus easily.
Eventually i've encountered this post: http://www.asserttrue.com/articles/2006/11/17/firefox-and-flash-swf-selection-and-focus-problems which solved this issue.
In order to focus flash in both firefox and IE, there're 2 things need to be done:
1. add wmode="opaque" to the object and to the embed
2. address the flash by name and not by ID or separating the code for IE and FireFox since each of the browsers is using different HTML tags (Object, Embed) and use the focus() method.
Happy programming
Liad
I tried using this idea:
<body onload="window.document.FlashName.focus();">
<object name="FlashName" ... />
<embed name="FlashName" ... />
</object>
</body>
but while this works in IE it's not working in firefox at all.
I also tried detecting the browser and focusing the embed instead of the object in firefox, but turns out that the embed can't take focus easily.
Eventually i've encountered this post: http://www.asserttrue.com/articles/2006/11/17/firefox-and-flash-swf-selection-and-focus-problems which solved this issue.
In order to focus flash in both firefox and IE, there're 2 things need to be done:
1. add wmode="opaque" to the object and to the embed
2. address the flash by name and not by ID or separating the code for IE and FireFox since each of the browsers is using different HTML tags (Object, Embed) and use the focus() method.
Happy programming
Liad
Comments