Proper way to embed flash content into your website

One of the things i dislike about YouTube is the Flash embed snippet they offer. It's just not valid xHTML and brings many errors. Actually, two things i dislike, the other is poor video quality compare to other sites like Revver or but that's not what i want to discuss about.

Anyway, the proper way to embed Flash content is by simply using:

<object type="application/x-shockwave-flash" data="" width="288" height="128"> 
<param name="movie" value="" /> 
<img src="banner.gif" width="288" height="128" alt="banner" /> 

So if you had a YouTube video you want to embed. For example a video of Kraftwerk - The Model (cover version by Balanescu Quartet), the snippet will look like this:

<object width="425" height="355">
<param name="movie" value=""></param> 
<param name="wmode" value="transparent"></param> 
<embed src="" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed >

We would rewrite this as valid Flash XHTML so it should look like this: 

<object type="application/x-shockwave-flash" data="" width="425" height="355"> 
<param name="movie" value="" /> 
<img src="noflash.gif" width="425" height="355" alt="No Flash plugin installed" /> 

It degrades to GIF image if Flash plugin is not available and HTML + CSS stays valid.

This code has been tested and works in Internet Explorer 5.01, 5.5, 6.0, Mozilla Firefox (former Mozilla Firebird), Opera and Konqueror and is fully XHTML Strict valid. No <embed> tags needed.

Note: Don't forget to escape ampersand (ie, &), if there are any in the URL.


The content of this field is kept private and will not be shown publicly.
Your email address will be kept private and will not be shown publicly.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.