YouTube validation errors: a quick fix

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="
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src=""
type="application/x-shockwave-flash" width="425" height="350"> </embed>

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"
<param name="movie" value="
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>

This code validates (xHTML 1.0 Strict) and the video plays as well as the original.

Drupal 6, youtube, validation issues

Recent Comments

Forward by Dries Buytaert, Founder and Project Lead, Drupal; CTO Acquia.

Order now from:

Managing Expectations Podcast with DrupalEasy

Author Interview

We provide the most Shiny Drupal Bits & Pixels

Since Drupal 4.x