Tag Archives: swf

Embed Flash video in valid XHTML

Getting a Flash video to embed in an XHTML strict document without breaking validity is something that has always been a frustration to me, as I aim for every website I build to be written so that it validates and is the most search engine friendly. After a bit of a hunt around, I came across this code snippet from Yoast.

Basically, the key is the <embed> tag that usually gets used. It’s not valid and it turns out, it’s not actually needed. So basically, you want something that looks like:

<object type="application/x-shockwave-flash"
	data="music/sound.swf"
	width="0" height="0">
	<param name="movie" value="music/sound.swf" />
	<param name="quality" value="high"/>
</object>

Thats basically it, just change the width and height to the dimensions you need and change the path in object and in the movie parameter. There you go.

As Yoast indicates, this doesn’t automatically update the Flash player for clients if a new version is needed, but thats fine for my purposes at the moment. You would need to add in a codebase attribute to the object tag in order to have it automatically check, but I think thats for another time.