Related Topics
No topics are associated with this blog
The problem to be solved is that you want to embed YouTube (or other Flash movies) but the <embed> tag is deprecated in XHTML and the <param> tags don't validate, either. Here are the steps to clean things up:
The original HTML from YouTube
<object width="425" height="344"> <param name="movie" value="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1"> </param> <param name="allowFullScreen" value="true"> </param> <param name="allowscriptaccess" value="always"> </param> <embed src="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"> </embed> </object>
Step 1: replace the closing "</param>" tags with trailing " />"
<object width="425" height="344"> <param name="movie" value="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <embed src="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"> </embed> </object>
Step 2: put type="application/x-shockwave-flash" into the <object> tag:
<object
width="425"
height="344"
type="application/x-shockwave-flash">
<param
name="movie"
value="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1" />
<param
name="allowFullScreen"
value="true" />
<param
name="allowscriptaccess"
value="always" />
<embed
src="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1"
type="application/x-shockwave-flash"
allowfullscreen="true"
width="425"
height="344">
</embed>
</object>
Step 3: move src="..." from the <embed> tag to a data="..." attribute in the <object> tag:
<object width="425" height="344" type="application/x-shockwave-flash" data="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1"> <param name="movie" value="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <embed src="https://www.youtube.com/v/zhWkTiMVWVI&color1=0xb1b1b1&color2=0xcfcfcf&hl=en&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"> </embed> </object>
Step 4: remove the <embed> tag:
<object width="425" height="344" type="application/x-shockwave-flash" data="https://www.youtube.com/v/zhWkTiMVWVI&hl=en&fs=1"> <param name="movie" value="https://www.youtube.com/v/zhWkTiMVWVI&hl=en&fs=1" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> </object>
You can View > Source to see that the code shown here does actually produce the YouTube video displayed.
Step X: it should be noted that in Firefox you don't need any "<param>" tags at all, which makes things very simple and clean:
<object width="425" height="344" type="application/x-shockwave-flash" data="https://www.youtube.com/v/zhWkTiMVWVI&hl=en&fs=1"> </object>
Not in IE, though; nope. (Why the </object> instead of a closing " />"? Because it seems to work more reliably in Firefox 3.0.5; I don't know why.)
Originally published: Saturday, January 10, 2009; most-recently modified: Monday, June 04, 2012
| Posted by: Wanita | Jul 29, 2011 1:06 PM |
| Posted by: G4 | Feb 15, 2009 1:06 PM |
| Posted by: Bill Hogsett | Feb 15, 2009 10:33 AM |