How to write valid XHTML code to embed Flash
Embedding Flash to XHTML is a big challenge. The old method is dead years ago even though still a lot of people use. For XHTML validation there are some techniques existing but they are complicated from who looks for a simple solution. Using Java Script is not a smart way either.
So while I was looking a simple solution I have found a Flash XHTML validator. It's simple enough to use. But not perfect! It gives me code as below;
<object type="application/x-shockwave-flash" data="banner.swf" width="300" height="200"> <param name="movie" value="banner.swf" />
It needs some tweak, so I simply added an image of my banner in case the visitor has no flash and adding a text for search engines. And the code end up as below;
<object type="application/x-shockwave-flash" data="banner.swf" width="300" height="200">
<param name="movie" value="banner.swf" />
<img src=”banner.gif” width=”300” height=”200” alt=”banner”/>
<p>A text for search engines.</p>
</object>
I might have add a link to Adobe's website for download flash plug-in, but it's fine.
I tested the code and it works in Internet Explorer 5.01, 5.5, 6.0, Mozilla, Mozilla Firefox (former Mozilla Firebird), Opera and Konqueror and is fully XHTML Strict valid. No <embed> tags needed.
Related useful stuff;
· Flash Satay: Embedding Flash While Supporting Standards
· Embedding Macromedia Flash in XHTML
· XHTML Validation & Flash Movies