Cutting edge web sites today are being lead by Macromedia Flash design. Flash web pages are dynamic, highly graphic and full of multimedia content. We often include flash applet in to page using <object /> and <embed /> tag. OK, it will work for most browser. But when we will care for XML name space and page validation by w3 or any other validation tool, our page will be not passed as a valid document. Why? Because <object> and <embed> is valid for HTML document, but not for XHTML document.
Here is an example code snippet for embed a flash applet in to a website –
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="738" height="100" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /> <param name="src" value="yourflash_applet.swf" /> <embed type="application/x-shockwave-flash" width="738" height="100" src="yourflash_applet.swf" quality="high"> </embed> </object>
To make our design error less and search engine friendly, we need to use javascript which will validated our XHTML document. Simply including this code will be validate our flash applet integration while validate a web page. We will not use <object> and <embed>
<script type="text/javascript"> <script type="text/javascript" src="js/swfobject.js"></script> var so = new SWFObject("swf/yourflash_applet.swf", "bannerhead", "400", "110", "8", "#ffffff"); so.addParam("quality", "high"); so.addParam("wmode", "transparent"); so.write("siteHeadBanner"); </script>
You can find the Javascript source from this link, please the copyright notice from the Author before use it.
SWFObject v1.5