Use Youtube's iframe to not need Flash

Flash had its time. It was good for some things, bad for others, but now except file uploading and video playing, really has not much life expectancy.

Regarding videos, Youtube already detects and supports a nice HTML 5 interface that avoids you having to load any SWF object.

I am trying to use Firefox with the Flash plugin fully disabled, and my only problem was watching embedded videos. So far, many people (myself included) embedded videos by the typical <object><embed>blablabla</embed></object>.

What I didn't knew until this morning was that if you use Youtube's iframe embed code fragment, it now detects if you have Flash or not, and if not if your browser supports it, renders directly with HTML5.

The code is dead simple to use:

<iframe src="https://www.youtube-nocookie.com/embed/XXXXX?rel=0" frameborder="0" 
width="480" height="392"></iframe>

Just add the video ID replacing the blue colored fragment, and there you go, Flash-free browsing.

You can see it in action by inspecting the source code of this page here:

Tags: Development

Use Youtube's iframe to not need Flash article, written by Kartones. Published on