Embedding YouTube Videos in Valid Web Pages

 

One 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>
  
</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> 

Leave a Reply

Your email address will not be published. Required fields are marked *