How to make youtube HTML embed code valid for w3c validator?

Here is my code.

<div>
    <object>
        <param name="movie" value="http://www.youtube.com/v/Cbspv1ZKR8o?version=3&amp;hl=en_US" />
        <param name="allowFullScreen" value="true" />
        <param value="transparent" name="wmode" />
        <param name="allowscriptaccess" value="always" />
        <embed src="http://www.youtube.com/v/Cbspv1ZKR8o?version=3&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" class="cssVideo"></embed>
    </object>
</div>

      

But the above code didn't pass W3C Validator . I search and try to follow these guides , but I can't seem to solve the problem.

Can anyone help me with this? Thank.

+3


source to share


2 answers


In fact, you don't need to always use the inline code provided from youtube.

Below is a typical way to change the inline version youtube

and test it.

<object type="application/x-shockwave-flash" width="425" height="350" data="http://www.youtube.com/v/n">
     <param name="movie" value="http://www.youtube.com/v/n" />
     <a href="http://get.adobe.com/flashplayer/" target="blank"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get flash player to play to this file" width="88" height="31" /></a><br />
</object>

      



Where n

is the youtube

video ID .

See demo check result

Greetings from Prabhu :)

0


source


If you re-read the articles posted, you will see that the correct versions do not use the object embed

(which is deprecated in xhtml-1.0).

Use



<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/Cbspv1ZKR8o?version=3&amp;hl=en_US" width="480" height="360">
    <param name="movie" value="http://www.youtube.com/v/Cbspv1ZKR8o?version=3&amp;hl=en_US" />
    <param name="allowFullScreen" value="true" />
    <param value="transparent" name="wmode" />
    <param name="allowscriptaccess" value="always" />
</object>

      

Working Demo and Validation

+4


source







All Articles