YouTube validation errors: a quick fix
User login
Friday, October 16, 2009 - 05:32
In one of our latest projects we were asked to implement a video gallery for a famous choreographer, using videos already uploaded in YouTube.
Well, it so appears that the code provided by Youtube fails the validation test with multiple errors, mostly concerning the "embed" element.
Here is the code, as provided by YouTube.
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/
v/FAM3tyAJ8Vw&hl=en&fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/FAM3tyAJ8Vw&hl=en&fs=1"
type="application/x-shockwave-flash" width="425" height="350"> </embed>
</object>
In order to get this YouTube code to validate, we had to do a workaround as following: One error that we should fix concerns the "&" found in the URL. That should be changed into &, and yes, even in a URL.
Now we can remove some outdated code, which leaves us with the following:
<object width="425" height="344" type="application/x-shockwave-flash"
data="http://www.youtube.com/v/FAM3tyAJ8Vw&hl=en&fs=1">
<param name="movie" value="http://www.youtube.com/v/
FAM3tyAJ8Vw&hl=en&fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
</object>
This code validates (xHTML 1.0 Strict) and the video plays as well as the original.
Tags:
Drupal 6, youtube, validation issues