|
There are several methods of embedding Flash swf files into your web pages depending upon what functionality you want if:
- Internet Explorer is in use
- Flash is not installed.
My own preference is to display alternative content, eg. an image, if Flash is not installed. Many users refuse to install Flash and they will not see anything. Alternative content will at least display your company's logo for example which is better than missing out on that fancy Flash logo you created .
Invite User to Install Flash
The following code will display an Adobe icon inviting the user to install the Flash Player if not already installed.
<script type="text/javascript" src="/js/swfobject.js"></script>
<script type="text/javascript"> var flashvars = {}; var params = {}; params.wmode = "transparent"; var attributes = {}; attributes.id = "jetking"; swfobject.embedSWF("flash/jetking.swf", "mainFlashAlt", "480", "175", "8.0.0", false, flashvars, params, attributes); </script>
<div id="mainflash"> <div id="mainFlashAlt"> <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> </div> </div>
The Simplest Method
A simple method:
<object width="250" height="250" type="application/x-shockwave-flash" id="jetking" data="/images/bouncingjet.swf"><param name="wmode" value="transparent"></object>
Alternative Content
This method will display alternative content if Flash is not installed. For Internet Explorer only, other browsers may not recognise the IF statements. I have not had a chance to test it with other browsers that don't have Flash installed.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420"> <param name="movie" value="myContent.swf" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="myContent.swf" width="780" height="420"> <!--<![endif]--> <p>Alternative content</p> <!--[if !IE]>--> </object> <!--<![endif]--> </object> |