I usually used embed for flash files, but I'm interested in using SwfObject. The question is, do I have to write this on the head of my web page?
<script type="text/javascript">
swfobject.registerObject("myId", "9.0.0", "expressInstall.swf");
</script>
Or could I simply use this:
<object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="120">
<param name="movie" value="test.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="test.swf" width="300" height="120">
<!--<![endif]-->
<div>
<h1>Alternative content</h1>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
Another question, what does the classid mean? do I have to provide this value?
Thanks
swfobject.registerSWF is only required in two use cases:
If neither of these cases apply to you, you can simply put the <object> element in your markup as you have written above.
If you decide to take advantage of swfobject.registerSWF, it should be placed in the <head> of your document, after importing the SWFObject JavaScript file. See the examples in the official documentation or at learnswfobject.com.
Regarding classid, it's for Internet Explorer. The outer <object> is for IE while the inner <object> is for pretty much every other browser. They require sightly different syntax. The classid value never changes. If you don't want to worry about it, use a SWFObject markup generator to generate the code for you: http://www.bobbyvandersluis.com/swfobject/generator/index.html or http://learnswfobject.com/generator/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With