Embedding YouTube Videos in Valid Web Pages

11 Apr 2008 /

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:

  1. <object width="425" height="355">
  2.   <param name="movie" value="http://www.youtube.com/v/xRCWnfMAmqE"></param>
  3.   <param name="wmode" value="transparent"></param>
  4.   src="http://www.youtube.com/v/xRCWnfMAmqE" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed>
  5. </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.

  1. <object type="application/x-shockwave-flash" style="width:425px; height:355px;" data="http://www.youtube.com/v/xRCWnfMAmqE">
  2.   <param name="movie" value="http://www.youtube.com/v/xRCWnfMAmqE" />
  3. </object>

No Comments on Embedding YouTube Videos in Valid Web Pages »

Why not be first?

TrackBack URI

RSS feed for comments on this post

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>