How to write valid HTML/XHTML code to include Flash

Updated May 27th 2008

An alternative suggested solution is using FlashReplace.

Hopefully, you’re someone who cares about web standards and wants to have valid code for the sake of web browsers’ rendering and for you as a web developer, to more easily spot errors right away. Then, when including Flash content in your web page, the default code output from various tools and web sites out there is invalid (at least when it comes to using them with a strict DOCTYPE, which I’d really recommend you to go with).

So, what should a poor caring web developer do?

Don’t fret my friend, there’s an easy and stable way to write valid HTML/XHTML code to include Flash in your web page. The simple code to do it looks like this:

HTML


<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/Z154yhLoS78">
	<param value="http://www.youtube.com/v/Z154yhLoS78" name="movie">
	<p>A movie with a very drunk guy that has gotten arrested. You need Flash to see it.</p>
</object>

XHTML

Only difference is that you will need to quick-close the param tag/-s:

<param value="http://www.youtube.com/v/Z154yhLoS78" name="movie" />

And the result will look this (with the exception that WordPress mangles it a little…):

A movie with a very drunk guy that has gotten arrested. You need Flash to see it.

Posted in Developing,HTML5/HTML/XHTML |

Leave a Reply

Your email address will not be published. Required fields are marked *