Ever since I started working with Flash, around 2000-2001, I have always groaned when it comes to embedding an SWF in a web page, mainly because it’s ugly. No amount of organizing and code formatting can make an <embed> and <object> sandwich look edible. On top of that, I was never quite certain if adding some JavaScript to the atrocity would be a good idea.
In those early days working with flash, I was not concerned with such boring terms as web standards and browser compatibility, but now that I am working on more practical projects, web standards and browser-compatibility are very important to me.
After researching for a couple of days, it seems the SWFObject 2.0 method is the way to go for now. A List Apart posted this great article which compares the historic methods of embedding Flash content. Here is a summarized list of “key ingredients of a great Flash embedding method” from that article:
- Standards Compliance
- Cross-Browser Support
- Support for Alternative Content
- Avoidance of Flash/Content Player Mismatches
- Auto-Activation of Active Content
- Ease of Implementation
Here is a quick summary of the methods used up to SWFObject 2.0 (From the A List Apart article mentioned above):
- <embed> (Which is proprietary)
- <object>
- The twice-cooked method (which the Flash IDE defecates onto auto published HTML pages)
- The nested-objects method
- The Flash Satay method
- JavaScript / DOM scripting
- Adobe’s Flash Player Detection Kit
- UFO (Unobtrusive Flash Object), by Bobby Van Der Sluis
- SWFObject 1.5, by Geoff Stearns
At this point, Bobby Van Der Sluis and Geoff Stearns have both stated that SWFObject 2.0 is the best method, mentioned here and here.
I will write a later post about my experience using the new method.