SWFObject/Internet Explorer conflict and workaround. Oh yes, and please stop using IE!
My dad, of all people, emailed me to tell me that my blog wasn't loading correctly in Internet Explorer on Windows. Thanks for letting me know, dad, you rock! Now stop using IE!
I was getting the following error: "Internet Explorer cannot open the Internet site . . . Operation aborted". A quick google turned up a blog post by Eoghan O'Brien that outlined the issue and why it was happening:
The problem is you can’t append to the body element from script that isn’t a direct child to the body element. It can be fixed simply by putting defer=â€defer†in the script tag.
According to the W3C, the defer attribute:
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.
This immediately made me suspect that the issue involved SWFObject and a quick test confirmed this.
The fix, as stated in Eoghan's post, was to put defer="defer" in the script tags whenever I was using SWFObject. I've only change the SWF that are currently displaying on the front page. I guess I'll have to go through and change every SWFObject in every post. What a pain. In the meanwhile, viewing older posts with Flash content in it may still kill IE (how I wish I could). Which brings me to a small request:
Dear reader, if you're using Internet Explorer at the moment, please do two things: One, exit it. And two, uninstall it. Oh yeah, you can't uninstall it because Microsoft owns your computer not you. OK, so at least don't use it. Here are some yummy alternatives: Firefox, Safari (hey, why not get a Mac while you're at it and enjoy the easy life?), and Opera.
Remember: Friends don't let friends use IE.
The SWFObject/Internet Explorer conflict and workaround. Oh yes, and please stop using IE! article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.

Clark
Please stop using HTML.
April 12th, 2007 at 4:14 pmKosso
Hmm. Weird, I’m using SWFObject over on podcast.com with no problems in IE.
Could it be because you’re calling the swfobject.js three times in your headers through plugins?
just a thought. but if I do now see this error you’ve had, I’ll know what to do.
ta.
—-
btw : on a totally different note, soon I hope to find some great flash/flex/apollo devs to have a crack at something like this, which uses all our opml and rss
http://podcast.com/swf/directory_feed_player_pod.html (unfinished)
April 12th, 2007 at 4:27 pmRob
I had a problem recently with IE and spaces in an ID tag, which was an error in it’s self but the way IE handled it with flash was very strange…
April 12th, 2007 at 5:07 pmGeoff
I get random reports now and again of this happening, but I’m not sure it’s just a matter of writing the content into a nested div - I think it’s usually related to people not properly closing their html tags, or sometimes putting the so.write() call inside the same div that they want the swf to go into… so you might check those out as well.
April 12th, 2007 at 5:17 pmGeoff
I did some testing, and I’m not sure that blog post you linked applies to this situation.
I made a test page here:
http://blog.deconcept.com/swfobject/swfobject_ieabort.html
Which has the flashcontent div inside another div (i nested it a few times actually) and then has swfobject write into that div, and I get no errors in IE7.
Also of note: SWFObject doesn’t use document.write - it just uses innerHTML, which should be safe to use any time you want, as long as the element you are injecting stuff into has completely loaded.
I’m thinking that there may be some conflict with another script on your blog - maybe something is trying to parse the whole html document and is causing IE to crap out since the document is changing at the same time this other script is parsing it? (I’m thinking maybe something like a getElementsByClassName or other function that might have to scan the full page… but this is just a guess.
April 12th, 2007 at 5:26 pmDustin Senos
Hey man,
Just took a look at your SWFObject script at the top of you page and your in innerHTML call aren’t escaped. Might not be the issue, but would be worth switching over just in case.
Bad “);
Good “);
Might be worth a try. I find the first step to fixing issues is always validating.
April 12th, 2007 at 5:47 pmDustin Senos
Well that didn’t quite show up how I was hoping.
Your greater than and less than characters aren’t escaped in the innerHTML for showing the flash version the user has.
April 12th, 2007 at 5:49 pmaral
Hey guys,
Thanks for the tips and insight. I just deactivated the plugin that was causing the redundant include (a leftover from when I was testing it.) The defer trick seems to have worked so I probably won’t investigate further at this point (got SWX to do!)
April 12th, 2007 at 7:47 pmSavvas Malamas
DIGG IT:IE doesn’t leave a father read his son’s blog!
April 12th, 2007 at 8:21 pmsubhero
>The defer trick seems to have worked so I probably won’t investigate further at this point (got SWX to do!)
That’s what we wAnt: ppl not bothering/knowing about the simple inner workings of their html-rendered blog templates invent new “kick butt” formats for data exchange.
April 12th, 2007 at 9:45 pmbrave new world, strange times.
off taking a piss
Haluk S. Balkan
I have loaded Firefox and I can reach your blog without any problem. Using IE I still continue having problem to load your blog, although what I see before it abondones to load has improved compared to what I experienced this morning.
April 12th, 2007 at 11:11 pmKristof
As I use SWFObject on nearly every web based project I really feared this problem would come back to haunt me.
First I suspected it would be the urchin tracker doing some weird stuff, but that isn’t it.
Then I tried blocking the second swfobject.js that gets loaded, but that wasn’t it either.
After that I presumed mootools was the culprit. It seemed to be, but it really wasn’t. It is just a dependency for videobox.js. MooTools doesn’t seem to be used anywhere on your frontpage except in videobox.js
Upon closer inspection it seems to be related to the combination of swfobject.js and videobox.js.
Videobox tries to add an eventlistener to the “domready” event.
After that it searches every “a” tag on the page that has a rel attribute beginning with “vidbox”.
It also seems to create quite a few elements.
As far as I can see there is no such element on the front page of your blog.
In conclusion: It might be a good idea to remove the link to the videobox.js file.
April 13th, 2007 at 12:38 amFurthermore I recommend removing the now unused mootools.js link, removing the duplicate SWFObject link and upgrading to SWFObject 1.5.
Jason
I’m using Windows 2000 and when trying to access the blog in IE6, I too get the “Operation Aborted” message. Clicking the OK button loads the “Page cannot be displayed” page… Loads fine in Firefox (which is my default browser
April 13th, 2007 at 1:44 amaral
@Kristof: *Doh* That would be it, then. I only just installed Videobox (the plugin version for wordpress) to play around with. OK, it’s history
April 13th, 2007 at 9:10 amaral
@Jason & dad: Could you guys try again on IE (after clearing your cache) and let me know if removing Videobox did the trick. It was working for me on IE even before removing that but it sounds like a time-related bug and may trigger or not based on the difference in download speeds.
April 13th, 2007 at 9:12 ampaddy
I thought you’d done that on purpose
April 13th, 2007 at 10:51 amKristof
Seems to work on Vista:
* msie7
* ff2.0.03
* op9.20
Seems to work on XP virtual machine:
April 13th, 2007 at 12:13 pm* msie6 (#page too wide, probably a glitch in css)
moloko
As far as I remember innerHTML isn’t a great thing to use anyway as it’s not a proper web standard (although all browsers support it).
Best practice is to use appendChild() instead, e.g.
//the text to write out
var mystr = “This is some text to write into the div flashPlayerInfo”;
//the div to write out to
var outputdiv = document.getElementById(”flashPlayerInfo”);
//clear anything that’s already in the div
if(outputdiv.firstChild) outputdiv.removeChild(outputdiv.firstChild);
//create new paragraph node
var newpara = document.createElement(”p”);
//add the text to it
newpara.appendChild(document.createTextNode(mystr));
//write out to the div
outputdiv.appendChild(newpara);
//clean up
outputdiv = null;
Obviously that’s a lot more lines of code but you can wrap it up into a function for easy re-use. It also avoids any issues around having to escape() special characters in your output string as createTextNode does that for you. Only caveat with that is if you want to use in your string it will escape that for you so you have to use the unicode version (\u00A0) instead.
On a separate note (but also to do with the crapness of IE) I found out the other day that if you store a reference to an element in a var, IE does not automatically remove that var from memory - so when doing AJAX pages in particular it’s important to explicitly clean up all vars that reference document elements - otherwise IE will start hogging all your RAM! See code above which does exactly that…
April 13th, 2007 at 1:19 pmmoloko
woops - the last sentence of the penultimate paragraph should read:
April 13th, 2007 at 1:23 pm“Only caveat with that is if you want to use in your string”
Haluk S. Balkan
I did not clear my cache but now I am able to reach to your blog witout any problem both from firefox and IE.
April 13th, 2007 at 2:35 pmThank You
Michiel van der Ros
Pfew, I was getting worried I needed to change all my SWFObject sites!
April 13th, 2007 at 3:19 pmGanar
The solution is not eliminating videobox.js. That is not a complete solution, just a workaround.
In our case we need it to run mootools and videobox , we found out that the solution is to create the SWFobject variable on the “onDOMready” event. That did it for us.
here is an example:
[code]
//
[/code]
We find that the interaction between mootools and SWFObject to be quite difficult. It is like learning to code again.
July 4th, 2007 at 1:57 amJan Jezek
I have had the same “operation aborted” problem with the **** IE explorer.
I have seen that the swfObject has troubles with the mootools javascript…
I have removed that…
now the site works
July 27th, 2007 at 5:30 pmJon
Ganar…for some reason the code you posted isn’t displaying for me. I was wondering if you could try explaining your solution again as I am running into the same problems using videobox.
Thank You
July 31st, 2007 at 4:24 ammikeh
Just a quick heads up for y’all - we were experiencing the same issue and eventually pinned it down to the slimbox include. I assume its the same root problem as you guys were having with videobox. Anyway I moved the include line for slimbox to right before the closing body tag … and that seems to have resolved the issue for now.
July 31st, 2007 at 12:48 pmcoober
Hi
having same problems with lightbox vs swfobject cooperation. Unfortunately it’s crucial for my project.
Niether
->moving initLightbox() to the end of body tag
nor
->
has done the trick for me so my last hope is to see Ganars solution ( to create swfobject variable on the “onDOMready” event ) but there sth wrong with the code.
I’d be SO grateful if somone could help me out ( i’m not really a coder ) - how to create a swfobject variable on the “onDOMready” event.
A simple piece of code and where to put it would be more than enough!
September 6th, 2007 at 9:33 pmzahur
can any body please tell me how to use swfobject? on my popup its no working.
thanks in advance
September 20th, 2007 at 9:37 amSander
After two hours of banging my head against the table, i read the solution her!
Thnx
September 27th, 2007 at 3:03 pmAritz
I have had the same problem with swfobject a slimbox. And the problem it isn´t between mootools and swfobject, it is with slimbox. The defer=”defer” works but only if you put it with slimbox. With swfobject doesn´t work.
November 2nd, 2007 at 6:22 pmSander
THE SOLUTION:
SWFObject conflicts with mootools. This is the fix:
window.addEvent(’load’, function(){
var movie = new SWFObject(”movie.swf”,”mymovie”,”400″,”200″,”8″, “#336699″);
movie.write(”flashcontent”);
});
Instead of:
var so = new SWFObject(”movie.swf”, “mymovie”, “400″, “200″, “8″, “#336699″);
December 3rd, 2007 at 1:51 pmso.write(”flashcontent”);
Pete
Sanders solution works, but now I have always a short delay before flash appears. The no-flash-GIF shows up for a second before flash appears. Any ideas for that?
December 3rd, 2007 at 6:58 pmSander
Use window.addEvent(’domready’ instead of load. The delay is shorter, but still there. Working on a fix
December 6th, 2007 at 2:42 pmSander
More one this, see http://www.rednas.be/news/43/swfobject-internet-explorer-error-fix
December 6th, 2007 at 3:05 pmRob
The above solution does not work for me, I am experiencing conflicts using jquery lightbox and swfobject.
December 14th, 2007 at 6:53 amabdellah
Thanks a billion my friend for the interesting post, thanks everyone who brought up a solution (the solution from sander worked great and he submitted it the day of my birthday (dec 6th ) !! ).
January 2nd, 2008 at 10:43 amAndrew
Has anyone experienced this problem with the Modx snippet version of SWFObject? I’m not sure how to implement these fixes given the code differences. Thanks!
http://modxcms.com/SWFObject-1815.html
January 30th, 2008 at 11:55 pmhttp://modxcms.com/forums/index.php?topic=21614
Andrew
This fixed the problem with Modx:
January 31st, 2008 at 5:24 pmSee http://modxcms.com/forums/index.php/topic,21791.msg134386.html#msg134386
Az
Hi,
February 6th, 2008 at 3:07 pmI just implemented the SWFObject to my website but now my popup windows are deactivated and nothing happens when you click on buttons? I have been searching for a fix but no joy. Any help would be much appreciated.
Jiaoheng
I moved the include line for slimbox/lightbox/mediabox to right before the closing body tag … and that have resolved the issue for now. This is Mikeh’s solution. Thanks Mike!
March 20th, 2008 at 5:30 pmFabio
OH MY F*CKING GOD!!!!
You are my hero!!
For like… months I’ve tried to get this conflict out of the way and this little article of yours fixed it with the use of two damn words!!! The SWFobject script interfered with my mootools library jamming my whole webpage and resulting in an complete IE crash. I love you man!
Thanks,
March 21st, 2008 at 10:21 pmFabio
dbcn
good god man, is it really that easy? I just dropped it in and am not seeing the problems. Thought it was a conflict with jquery, but i guess it’s just M$ being their usual crappy selves.
Thanks very much for the solution!
March 26th, 2008 at 3:49 pmMatt
I was running into this same error. I am running MediaBox and SWFObject1.5 and changing how the mediabox is executed seemed to do the trick. Change it from “domready” to “load”.
Mootools explains that domready will execute after all the html is loaded (not necessarily images though) while load will execute after all images and html is loaded. http://demos.mootools.net/DomReadyVS.Load
March 27th, 2008 at 4:08 pmJulia
I’m not using mootools and still experience problems with SWFObject and IE. I tried to add defer=”defer” and I get something odd. I have a preloader that’s loading my main movie and I pass the preloader to the swfobject. And if I add defer=”defer” to the javascript tag then the preloader is not displayed but the main movie still loads.
March 31st, 2008 at 11:13 pmKevin Mask
I had the same problem developing in Flex and then trying to use the History Manager + history.js and historyFrame.html. I didn’t need the history manager, I just let flex build the html page for me and then loaded all the files from the “build-release” and then switched from the canned html page to the swfobject script. I forgot to take the history behavior and frame out. I kept getting a frame and couldn’t figure out where it was coming from. Then I deleted the script reference to the history.js file and viola, no more problems.
April 15th, 2008 at 1:28 amFlorian
So, I have been using swfObject 2.0 and everything works fine now
April 21st, 2008 at 9:47 amFrederic
I’ve had the same problem. I figured out that the IE crashes if you try to append a tag to the bodytag and the scripttag isn’t a child of body too.
This crashes:
TESTSEITE
TESTSEITE
var divTag = document.createElement(’div’);
document.body.appendChild(divTag);
This works:
TESTSEITE
TESTSEITE
var divTag = document.createElement(’div’);
document.body.appendChild(divTag);
However, I explained that a bit longer on my Typo3-Blog on http://www.typo3-scout.de. But sadly, it’s written in german.
May 14th, 2008 at 8:09 amFrederic
Sorry for the last comment! Html is not working. Please look at http://www.typo3-scout.de/2008/05/14/js-error-in-ie-totalabbruch/#more-15 to see the code…
May 14th, 2008 at 8:11 amVirtualVoid
If you are attempting to use this on an .aspx page that also uses a ComponentArt object you will have the issue described at the top of this page, but worse - it will refuse to load in IE7.
After reading through the replies here I changed the last line of code in the videobox.js file from “window.addEvent(’domready’, Videobox.init.bind(Videobox));” to “window.addEvent(’load’, Videobox.init.bind(Videobox));” and that did the trick for me.
May 16th, 2008 at 8:35 pmMichael Kelly
IE is the Devil.
June 2nd, 2008 at 4:32 pmsanela novo
hi, if you are having problems with video in your posts, try my new plugin:
June 9th, 2008 at 8:16 pmhttp://jwmpplugin.wordpress.com/
ryan
defer thing didn’t solve the problem. I dont really know dom scripting but that option didn’t seem to work either. The only thing that did seem to work was adding the javascript call right before the closing body tag. Thanks to whoever suggested that workaround.
In regards to IE isn’t it time we quit going out of our way to support the crappy browser. How will the masses know the browser (IE) is the problem if we keep creating workarounds/hacks.
June 11th, 2008 at 8:02 amSkye
I can’t seem to view my facebook profile. The profile comes up and then right after this error box with, “Internet Explorer cannot open the internet site. Operation aborted”,pops up as well. I click okay and it brings me to the page saying “web page can not be found” or whatever…Its been a whole day since I looked at my profile and I know its happening when others click to see my profile and can’t. Please help!!!
June 11th, 2008 at 10:51 pmDude
All of this has been somewhat enlightening. The best explanation of what exactly is going on here that I’ve found yet: http://www.garyharan.com/index.php/2008/04/22/internet-explorer-cannot-open-the-internet-site-operation-aborted/ And no - I’m not Gary.
June 18th, 2008 at 5:33 pmEric
I fail to see why people should stop using ie because some people cant make stuff that works right. There are things that work in ie that don’t your in other browsers to but i don’t hear you saying stop using them.
June 30th, 2008 at 12:13 pmPedro Duarte
Hey guys.
Ive spent HOURS and HOURS and HOURS trying to fix this.
I did everything any1 could think of!
On my page, i have at least 10 scripts. mootools, lightbox, and some other marketing scripts.
The FLV Video was loading and working 100% fine on Firefox.
but it wouldnt load on IE!
When i added the defer=”defer” something else would stop working.
The window.addEvent(’domready’ and ‘load’) did not work…
anyhow, nothing worked!
THE SOLUTION IS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Take your all the way to
OUT OF THE BODY TAG!
This is one of the reasons that it doesnt work.
Now…
Put the script inside the HEAD TAG!
function startvideo()
{
var s1 = new SWFObject(’player.swf’,'ply’,'210′,’170′,’9′,’#FFFFFF’);
etc…
IMPORTANT!!!
Now on the Body tag, add the following:
AND THERE YOU GO!
cheers!
July 24th, 2008 at 1:59 amPedro Duarte
hey my code didnt show up properly!
So after u move your script to the head dat and add the funcion.startvideo()
go to your body tag and just next to where it says body add onload=”startvideo();” >
July 24th, 2008 at 8:44 amJeff
I ran across another cause of this problem: I had my javascript accidentally placed within tags. This attempted hyperlink is ignored by all other browsers, but it causes this error in IE.
Hope that helps someone out there as clueless as me…
September 16th, 2008 at 4:54 amJeff
Oops. Let’s try that again. I had my javascript accidentally placed within <a> tags.
September 16th, 2008 at 4:57 amBrian Lewandowski
How does one incorporate this fix into an html file?
window.addEvent(’load’, function(){
var movie = new SWFObject(â€movie.swfâ€,â€mymovieâ€,â€400″,â€200″,â€8″, “#336699″);
movie.write(â€flashcontentâ€);
});
I am using the Videobox application and don’t know what the “movie.swf” and “mymovie” variables are (they must be in the compiled videobox.js file).
I used the “defer” suggestion but it didn’t work on swfobjects.js. I used it in mootools.js and while Videobox still doensn’t work in IE, this hack did allow each post in the blog using this javascript to load.
I am not a programmer so anyone who knows how I might incorporate this for the Videobox application, please explain in non-techie details or write down the specific example.
September 17th, 2008 at 9:47 pmjasper
Thnx you just saved me another worry with IE… which i only start if i really have to… but with all the buggy issues that’s still quit a lot
September 22nd, 2008 at 9:22 amphils
None of your methods worked for me with multiple swfobject calls on one page so..
1
function video1(){
var s1 = new SWFObject(”player/player.swf”,”ply”,”300″,”243″,”9″,”#FFFFFF”);
s1.addParam(”allowfullscreen”,”true”);
s1.addParam(”allowscriptaccess”,”always”);
s1.addParam(”flashvars”,”file=/video.flv&image=images.jpg”);
s1.write(”videome1″);
};
2
function video2(){
var s1 = new SWFObject(”player/player.swf”,”ply”,”300″,”243″,”9″,”#FFFFFF”);
s1.addParam(”allowfullscreen”,”true”);
s1.addParam(”allowscriptaccess”,”always”);
s1.addParam(”flashvars”,”file=/video2.flv&image=images2.jpg”);
s1.write(”videome2″);
};
Now they are all independent functions and will be called after the page has loaded, No conflicts with lightbox, works on IE6, 7 and all the better browsers.
October 6th, 2008 at 10:17 amphils
Silly me, tags..
Missed off
body onload=video1(); video2();
div id=videome1
October 6th, 2008 at 10:18 amçet
thansk oyu goog. çet
October 22nd, 2008 at 6:32 pmsohbet sitesi
çet
Pamela Kramer
I’m getting the same error with my own blog. I was researching how to fix it and your site came up. I have no idea what you guys are talking about! I wish I did so I could fix it. rofl.
October 27th, 2008 at 5:08 amTom webdesign
We have about the same problem on a wordpress website…
“this method is not accepted by this object”
October 29th, 2008 at 3:36 pmOnly on IE7 and IE8beta , not on FF
Tim H
FYI, for anyone having a related problem involving SWFObject error “Object doesn’t support this property or method” when using External Interface.
Here is the “official” adobe solution:
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb400730
They have 2 solutions, one didnt work for me, the other did work.
November 8th, 2008 at 12:21 amnick
What file exactly would I put this tag?
November 12th, 2008 at 3:15 pmnick
Excuse me, this tag: script type=”text/javascript” defer=”defer”
November 12th, 2008 at 3:15 pm