Embedding YouTube Videos in Valid Web Pages
11 Apr 2008 / PEOne thing I learned from this post is that YouTube's recommended method for embedding videos in web pages will prevent your page from validating:
-
<object width="425" height="355">
-
<param name="movie" value="http://www.youtube.com/v/xRCWnfMAmqE"></param>
-
<param name="wmode" value="transparent"></param>
-
<embed src="http://www.youtube.com/v/xRCWnfMAmqE" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed>
-
</object>
The <embed> element is Netscape's method of embedding plugins and players in web pages. It’s not part of the XHTML specification.
If you care about this kind of thing, you can use the markup below instead. It's simpler, it validates, and it works (I tested it) in IE, Firefox, Safari and Opera.
-
<object type="application/x-shockwave-flash" style="width:425px; height:355px;" data="http://www.youtube.com/v/xRCWnfMAmqE">
-
<param name="movie" value="http://www.youtube.com/v/xRCWnfMAmqE" />
-
</object>