SWFObject and IE6 causing hair-pulling agony

I recently used SWFObject to display a flash header on a website. I chose SWFObject because:

  • Instead of displaying an annoying ‘Install flash now’ message, it claims to be able to show alternate content. In this case: the original header image.
  • It claims to be compatible with more or less every browser out there.

Implementation went fine, until someone tested it on IE6 and got the following error:

Internet explorer cannot open the Internet site http://www…..
Operation aborted

Which basically means that the site just can’t be visited with IE6 (still used a lot in business environments), it even seems as if there’s something wrong with your internet connection.

Now, since about 10% of visitors to this site are still using IE6 (why does everyone still use Internet Explorer ???? Do YOU know that these days most people do NOT use Internet Explorer anymore ?)

Now after some googling, I found the suggestion to defer loading of the SWFObject.js as follows:

<script type="text/javascript" defer="defer" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js">
<script type="text/javascript" defer="defer">
swfobject.registerObject("myId", "9", "");

What this does according to W3C: When set, this boolean attribute provides a hint to the user agent that the script is not going to generate any document content (e.g., no “document.write” in javascript) and thus, the user agent can continue parsing and rendering.
I don’t know exactly why, but: HURRAY! It works now!!! Only… IE6 and IE7 (didn’t try IE8) now gave the following error:

Line: 19
Char: 1
Error: ‘swfobject’ is undefined
Code: 0
URL: http://www…

But the flash was still running fine. Still, such an error isn’t clean, especially since almost half of the site’s visitors are using one of these Internet Explorer versions.

Now, wanting a quick fix I decided to do the following:

<script type="text/javascript" defer="defer">
if (typeof(swfobject) != "undefined")
swfobject.registerObject("myId", "9", "");

I admit this is a bit of a weird ‘fix’. You’d suspect the flash to stop working on IE6/IE7, which it doesn’t. Not planning on diving into it’s inner bowels, I regard this a ‘mission accomplished’ until someone somewhere posts a better solution (for which I setup some Google alerts).

Do you have a better solution?
What would be the impact on the webdev economy (or your life) if all browsers were compatible?


Because the above turned out not to work with the new Firefox 3.5.3 (strangely, was OK with 3.5.2 when I tested it) I decided to cut the crap and use the ‘Dynamic Publishing’ way. Ok, so it won’t work for people who have javascript disabled, but who on earth would have flash installed AND javascript disabled?

To avoid the IE6 error with the ‘Dynamic Publishing’ way, I call swfobject.embedSWF right after the div that will be replaced with the flash content. Calling swfobject.embedSWF in the <head> would otherwise give me the above error in IE6 again.


  1. Thank you so much, ran into the same problem and whatever happens, your fix works like a charm 🙂 Great job!

  2. Just a little note, seems that Firefox 3.5.2. doesn’t show the swfobject now. Sorry. I know you hate me now 😉 I’m more a designer than programmer so can’t fix it for you.

  3. Last time. I posted the problem in a Dutch forum. Instead of your fix you can solve it much easier.

    Just place the

    swfobject.registerObject(”myId”, “9″, “”);

    Under the div you want your Flash in or just above to be safe. Works in IE6, no other fix needed and even Firefox is happy with that solution. Hope it works for you as well.

  4. Piet

    August 17, 2009 at 2:33 pm

    Thanks for the info Oscar!
    Just tested on Firefox 3.5.2 – works here (under windows XP).

    Will try your suggestion later on.

  5. Doesn’t work for me.

    Mac OS X Snow Leopard
    Firefox 3.4.5
    Safari 4.0.3 (6531.9)

    Windows XP
    Internet Explorer 6.x


  6. Hey

    having an oddproblem where the second of two swf objects doesnt work. the page turns blank. The top banner on the url above works but the middle one, appears for a while (loading) then vanishes. I tried all sorts. Have a look at sourcecode of page. Only in IE 6 there is a problem. Its SWFObject 2.0. Thankful for any clues !


  7. Encountered the same error – however I had a look at the documentation on GoogleCode and to reproduce the problem:
    1. Include tags in head
    2. Include tags in body
    3. try to load page in IE6.

    I tried the defer trick but that didn’t work. Instead I simply placed the registerObject script inside the body of the page. Booyah. I suspect I had placed that line in the wrong place in the document all along…

  8. Just add “defer” attr to the script tag.

Leave a Reply

Your email address will not be published.