Web Standards Flash embedding (Part 2)

Since I posted the FlashObject embed I got a little bit of feedback on the validity of the Javascript I used (Specifically the document.write and node.innerHTML methods) and how they relate to XHTML pages served with mime types of application/xhtml+xml. The short version is ‘they don’t work at all’ and in fact fail miserably by not even providing the alternate content.

You may be asking: Is this really a problem? I say not yet. The only time this will ever be an issue is if you are serving your XHTML pages with mime types of application/xhtml+xml. I don’t know of any websites at all that serve their content like that, so as long as you stay in text/html land, you will be fine.

In fact, here’s a quick list of your favorite web standards compliant websites with their doctypes and the mime types of their content: (If you want to check your own site and have access to a Linux/OS X machine, try ‘curl -I -H 'Accept:application/xhtml+xml' mysite.com‘ in the terminal)

And the list goes on – sprintpcs.com, disney.co.uk, kcchiefs.com – all text/html mime types. My point obviously being that there is no demand right now for DOM Javascript when it comes to embedding Flash or doing other web/XHTML related things. I think it’s pretty safe to say that we’ll have another couple of years before we really have to start worrying about combining Flash and XML documents.

With all that said, I did mess around with some DOM Javascript without much success. Mozilla / Firefox handled it pretty well and all is great there, Safari seems to ignore the param tags inside the object tag, Opera is very strict (perhaps too strict?) and wouldn’t even let me use setAttribute for width or height on the object tag.

I’ll write up a whole thing on my findings soon, and possibly provide a hacked together DOM way of embedding Flash, but I won’t be recommending that you use it, as the file size will most likely be larger than using a simple document.write or innerHTML.

UPDATE (10-31-2004): This guy over here thinks that I’m advocating the use of text/html mime types. Well I’m not, this is just pointing out that since so few websites serve content as application/xhtml+xml that using node.innerHTML or document.write will work better compared to the alternative DOM methods, which are such a pain in the ass, I keep putting off building the sample page to show how you do it.


About this page

blog.deconcept.com is a blog about nerdy internet stuff edited by Geoff Stearns since late 2004.