1.embed is illegal
The <embed> tag is a private tag of Netscape. Although the <embed> tag is widely used, from HTML3.2, HTML4.0 to XHTML1.0, W3C has not included this tag. Pages using the <embed> tag will not pass W3C validation.
2. You should use object
The W3C recommends the <object> tag. Even in XHTML2, <img> is replaced by <object>. The code to insert flash using the <object> method is:
<object type="application/x-shockwave-flash" data="test.swf" width="200" height="100"> <parm name="movie" value="test.swf /> </object>
However, this method cannot be displayed correctly on IE5-IE6/Win (it cannot be played continuously and cannot be played until it is downloaded), but it can be displayed correctly on lower versions. Later, the method of adjusting a small flash file first and then embedding the large flash file solved the problem of continuous playback. However, in IE5 and above, sometimes the flash still cannot be displayed.
3. Current temporary measures
So what should you do to not only comply with standards but also display flash correctly in all browsers? How does the macromedia website pass W3c verification?
Some designers thought of using JavaScript to hide illegal <embed> tags.
<script type="text/javascript "> if (navegiator . mimeTypes && navigator .
mimeTypes["application/x-shockwave-flash"] { document . write('<embed src="test . swf" ...
This is currently a better solution. You must insert flash and use js to call it. This method can deceive the W3C verification program and make the page pass verification. But it's just "cheating", not really meeting the standards.
How does macromedia do it? See this code:
<!-- $RCSfile: FlashDetection2k.pm,v $ $Revision: 1.68 $ : your browser's accept header indicates you have Flash 6,0,65,0 or better, so you're OK for this Flash 6 movie, here it comes. -->
It adopts a compromise approach:
(1). First, javascript determines your browser version and flash player version;
(2). Dynamically generate HTML code in the background according to different versions.
To put it simply, the <object> method is used by default. If the browser cannot handle the MIME type "application/x-shockwave-flash" of object, it inserts the child element <embed>. To put it bluntly, this is similar to using js to hide <embed>. It is also a "cheating" method, but this is the most standard and perfect method that can be done at present.
If you want to really abandon <embed>, you can only wait for IE browser to have better support for <object>, maybe until Longhorn comes out.