January 9th, 2007  
Donkey
Kilobyte
 

Posts: 207
Country: United States
Microchips: 208
Gadgets

Post - Cross browser compatiable W3C valid XHTML for inserting flash


The best way I found to insert flash into xhtml for cross browser compatibility is this

it is XHTML valid and works on everything I know of so far

HTML Code:
 <div style="text-align: center;"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='5,0,42,0'"
      id="Movie1" width="374" height="224"> <param name="moviename" value="moviename.swf" /> <param name="quality" value="High" /> <param name="bgcolor" value="#000000" /> <param name="allowScriptAccess" value="sameDomain" /> <script type="text/javascript" src="moviename.js"> <noscript>
       javascript support required
      </noscript> </object> </div>


and create the following "moviename.js" file


Code:
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) { document.writeln(' <embed name="moviename" src="moviename.swf"'); document.writeln(' quality="high" bgcolor="#000000" swLiveConnect="true" allowScriptAccess="sameDomain"'); document.writeln(' width="374" height="224"'); document.writeln(' type="application/x-shockwave-flash"'); document.writeln(' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'); } else { document.writeln('No flash player plugin installed'); }
The Java Script controls how the flash is viewed in FireFox (type) and the xhtml controls how the flash is viewed in IE (type)

adjust the width and height to suit your needs (in both the xhtml and java).