Embedding XHTML-Valid Flash

Although I tend to stay away from flash there are times when you may want to use it in your site. According to Adobe the proper way to embed a flash object in an HTML document is,

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="550" HEIGHT="400" id="myMovieName"><PARAM NAME=movie VALUE="myFlashMovie.swf"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="myFlashMovie.swf" quality=high bgcolor=#FFFFFF WIDTH="550" HEIGHT="400"
NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>

The problem with this is it’s not XHTML valid. The embed tag is something invented by Netscape and never was a part of the W3C specs. Fortunately there is a way to properly embed flash so that it does validate,

<object type="application/x-shockwave-flash" data="myFlashMovie.swf" height="400" width="550"><param name="movie" value="myFlashMovie.swf" /></object>

Isn’t that much nicer? Alternatively you may wish to use a plugin for your WordPress site. The Kimili Flash Embed plugin will automagically embed valid flash objects in your document via the use of its special tag,

[kml_flashembed movie="/path/to/your/movie.swf" height="300" width="300" /]
About Len Kutchma

Len has been blogging for over 10 years and is a rabid WordPress fan. In addition to blogging here you can find him writing the occasional article and toiling away in the forums at WeblogToolsCollection.com. He also hangs out at the WordPress support forums lending a hand when he can. You can also find him at Google+ Twitter and GitHub.

Comments

  1. Thanks, dude! I’ve been looking for something nice ‘n’ simple like this for a while but never quite got around to it…

  2. You’re most welcome Dennis.

  3. steve fox says:

    It doesn’t work in FireFox

  4. Thanks for the input Steve. I haven’t actually tested it using Firefox.

  5. My friend and I were frustrated by this problem, and we saw a lot of other people were too, so we released a free tool called Validifier. Hope this helps someone! Check it out at http://validifier.com/

  6. Thanks for the heads up Nick!

What Do You Think?

*

Please read the Comment Policy before submitting a comment.