Blog

HTML5 embedcode van YouTube

HTML4 :

<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/VIDEO_ID&hl=nl_NL&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/VIDEO_ID&hl=nl_NL&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>

HTML5 :

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
</iframe>

Opmerking :

  • Het Type attribuut is in HTML5 niet langer nodig;
  • Frameborder kan worden vervangen door de CSS eigenschap border-style :
iframe.youtube-player {
	border-style: none;
}

Resultaat :

<iframe class="youtube-player" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID">
</iframe>

P.S. VIDEO_ID vervangen.

Meer informatie : A New Way To Embed YouTube Videos

Zoeken