Youtube videos and XHTML
May 14th, 2006 Chris Posted in Uncategorized |
Youtube gives you a nice little snippet of code that allows you to embed a movie in your own webpage. (As I did below, with the X3 trailer). Unfortunately, the code they provide doesn’t validate as XHTML compliant. Luckily, there’s a pretty easy fix.
The code they give you:
<object width=”425″ height=”350″>
<param name=”movie” value=”http://www.youtube.com/v/OLTdN-BbOok”> </param>
<embed src=”http://www.youtube.com/v/OLTdN-BbOok” type=”application/x-shockwave-flash” width=”425″ height=”350″> </embed> </object>
You sould modify this code to look like this, keeping all the URLs the same:
<object data=”http://www.youtube.com/v/OLTdN-BbOok” type=”application/x-shockwave-flash” height=”350″ width=”425″>
<param name=”movie” value=”http://www.youtube.com/v/OLTdN-BbOok” /> </object>
Easy enough.









June 5th, 2006 at 1:56 pm
You need to close your param tag, or else it still won’t validate.
June 5th, 2006 at 6:44 pm
Good call. I validated it, then made a typo in my posting. Thanks for the heads up.
June 5th, 2006 at 7:21 pm
Thanks for the code, btw! It works perfectly.