JavaScript and Embedded Objects - Cross-Browser Inclusion of Embedded Objects (Page 13 of 15 )
By far the best way to ensure the cross-browser compatibility of your pages is to use a combination of ActiveX controls and plug-in syntax. To accomplish this, use an <object> intended for IE/Windows ActiveX controls and include within it an <embed> intended for Netscape and IE/Macintosh plug-ins. The technique is illustrated in the following example:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#\ version=6,0,40,0"
name="demoMovie" id="demoMovie" width="318" height="252"> <param name="movie" value=http://www.javascriptref.com/examples/ch18/flash.swf
/>
<param name="play" value="true" />
<param name="loop" value="false" />
<param name="quality" value="high" />
<embed src="http://www.javascriptref.com/examples/ch18/flash.swf"
width"318" height="252" play="true" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"> <noembed>
Error: No Object or Embed Support
</noembed>
</embed>
</object>
Browsers that do not understand <object> will see the <embed>, whereas browsers capable of processing <object> will ignore the enclosed <embed>. Using <object> and <embed> in concert maximizes the possibility that the user will be able to process your content.
This chapter is from JavaScript: The Complete Reference, second edition, by Thomas Powell and Fritz Schneider, McGraw-Hill/Osborne, ISBN: 0072253576). Check it out at your favorite bookstore today.
Buy this book now. |
Next: Interacting with ActiveX Controls >>
More JavaScript Articles
More By McGraw-Hill/Osborne