I like this Flash embed technique.
Assuming I don’t want to do any player detection*, don’t care about using the embed** tag, and just want to get the swf into the doc without IE hiccuping on it because of the Eolas patent dispute, I’m thinking this is my default Flash embed technique going forward.
This tiny bit of code gets around the “click to activate and use this control” IE issue and allows me to use traditional HTML methods to embed the SWF for browsers that didn’t lose a multimillion dollar lawsuit and can just present Flash the old school way. This also allows people with Flash installed and no JavaScript to see the Flash content (I wonder how many people that actually is.)
Assuming a div with the id of “flashcontent” on the page, we run this in an included script file onload (or equivalent).
/*@cc_on @*/
/*@if (@_win32)
the_swf=document.getElemebtById("flashcontent").innerHTML
document.getElemebtById("flashcontent").innerHTML = the_swf
/*@end @*/
We use some conditional compilation to hide the script from anything but IE and then we just do a pointless switcheroo, replacing the innerHTML of the div with itself. Amazingly, that’s all it takes to workaround the Eolas issue. And that’s that.
Personally, I’m sold.
*for fancy stuff see the excellent swfobject.
**on the same page you can see an “object only technique” to use if getting rid of the embed tag is important