Thursday, November 2, 2006 4:58 PM InfinitiesLoop

Dealing with IE "Operation Aborted". Or, how to Crash IE

It's easy to create runtime errors in JavaScript. But it's not every day you find a way to crash the runtime entirely.

It looks so innocent, yet it is so delightfully evil... copy/paste this into a simple HTML file and open it.

<html>
<head>
    <script type="text/javascript">
    function appendToBody() {
        var span = document.createElement('span');
        document.body.appendChild(span);        
    }
    </script>
</head>
<body>
    <form>
        <script type="text/javascript">
            appendToBody();
        </script>
    </form>
</body>
</html>

This is what you see:


For the search engines: "Internet Explorer cannot open the Internet site", "Operation aborted" :)

Upon clicking the one and only thing you can click on, your page is completely replaced with this...


"The page cannot be displayed"

Unfortunately the error isn't very helpful, so if you run into this you will likely scratch your head searching for an answer. You'll probably find suggestions like "reinstall IE" or "use Firefox". Don't listen to that nonsense :)

The problem is you can't append to the BODY element from script that isn't a direct child to the BODY element.

If you research it enough, you will find that some people ran into this when they had script inside a <table>. The proposed fix was to move the script outside the <table> element. But that would only work if the <table> was a direct child to the body! If the table is inside yet another element, it will still fail.

And of course, it's ok if your script isn't a direct child of BODY as long as it doesn't execute inline while the page is being parsed. So for our example here, you could fix it by moving the script to the top or bottom of the body, moving it after the body, or putting it in a function and calling it from window.onload or in response to some other event.

With AJAX apps becoming ever more popular, DOM manipulation is becoming more commonplace, and I fear more and more people may run into this. Hopefully this helps.

Filed under: , ,

Comments

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, November 2, 2006 9:25 PM by Joe Chung

Is there a good reason to execute script in an HTML body instead of in the HTML HEAD?  This error seems like a great reason not to.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, November 3, 2006 12:10 AM by InfinitiesLoop

I'm afraid for this specific example that won't work -- the body hasn't been parsed yet by the browser when you're still in the head element. So, "document.body" will be null. Now, having that same script hookup to window.onload and manipulate the body in the handler, that would work. There are times where you need to do things before window.onload though.

I don't want this to turn into a sequence of comments about best practices -- the point of the article is to help people figure out what is causing the error, nothing more. Avoiding the error in the first place is an entirely different topic :)

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, November 3, 2006 2:17 AM by Damien

it's a pity that IE does not handle this situation better. I#ve seen commerical enterprise applications that routinely spit out this message.  

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, November 3, 2006 7:02 PM by InfinitiesLoop

frb -- waiting for window.onload is a safe bet. However there are times when that is not good enough. The DOM itself is ready for manipulation before window.onload, because window.onload waits for all binary content to also be downloaded. Imagine you have some huge picture to download or sound file -- the page will sit there, ready for manipulation while it downloads. So certainly sometimes window.onload isn't soon enough.

Some browsers have a non standard event that states the dom is ready (IE does not, but putting code at the bottom of the body or using a script defer tag are just some of the tricks you can use to simulate one).

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, November 13, 2006 10:49 AM by James Alexander

Thanks hommie, this really helped!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, December 5, 2006 12:32 AM by Patrick

Great help, really saved my butt!

Thanks!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, January 2, 2007 5:28 PM by richard

<quote>Is there a good reason to execute script in an HTML body instead of in the HTML HEAD?  This error seems like a great reason not to.</quote>

Well, in my appplication I wanted to display a message about page being loaded right at the beginning. Obviously I can't wait for the load event with this (that is supposed to hide the message), nor can I move the stuff the <head> because the script is a part of a template, which doesn't have head section (it's included by the templating framework somwhere else). Had to turn this off for all MSIE users. (this bug is present in IE7 as well)

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, January 2, 2007 6:20 PM by InfinitiesLoop

richard -- if you have inline script that needs to insert dom elements, you can do it with document.write(). You can use appendChild as well, just as long as its to an element that is previous and already closed. No need to disable it for all of IE... just avoid appending to an incomplete element, pretty simple.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, January 3, 2007 2:08 AM by InfinitiesLoop

Defer delays the execution of the script in IE, but not other browsers. So you could end up with different behavior if you use it. Its a quick fix if it fits your scenario, but consider better solutions.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, February 23, 2007 4:53 AM by vadivel

i need to touch with u ... i like it ...this site is very use ful for me ...

i m .net Employee , i m working in india

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, March 21, 2007 11:24 AM by Webman

That error was smashing me in the teeth. Thanks for the post! Great job...

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Sunday, April 15, 2007 3:16 PM by Sumit Mehrotra

Thanks a lot for sharing this information

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, December 27, 2007 12:41 PM by Paul Gusakov

The described crash can be caused by CSS expressions.

Here's the example of implementing round corner block:

.xreview { background: #e0e9fd; padding: 8px 20px 20px 20px; margin: 0 6px 20px 15px; font-family: Georgia, "Times New Roman", Times, serif; color: #303030; font-size: 12px;}

/* Mozilla additions work perfectly */

.xreview:before { content: url(/img/xreview_top_left.gif); background: url(/img/xreview_top_right.gif) no-repeat 100% 0; height: 20px; display: block; margin: -8px -20px -8px -20px; }

.xreview:after { content: url(/img/xreview_bottom_left.gif); background: url(/img/xreview_bottom_right.gif) no-repeat 100% 0; height: 20px; display: block; margin: -8px -20px -24px -20px; }

/* IE6 addition which crashes occasionally */

.xreview { zoom:1; behavior:expression(!this.isInserted==true ? this.isInserted=(this.innerHTML = '<span style="background: url(/img/xreview_top_right.gif) no-repeat 100% 0;height: 20px;display: block;margin: -8px -20px -8px -20px;"><img src="/img/xreview_top_left.gif" alt="" /></span>' + this.innerHTML + '<span style="background: url(/img/xreview_bottom_right.gif) no-repeat 100% 0;height: 20px;display: block;margin:-8px -20px -24px -20px"><img src="/img/xreview_bottom_left.gif" alt="" /></span>') : ''); }

Note that IE won't crash every time and that makes bug more difficult to catch.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, January 11, 2008 5:07 PM by Dan irwin

how do you mfix this i don't understand

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, January 29, 2008 11:43 PM by rad

dude u saved our a$$.. thanks...

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, February 12, 2008 3:04 AM by Atikorn

setTimeout is ok for me.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, March 24, 2008 10:58 AM by Kluyg

"window.onload = appendToBody;" work perfect, thx!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, March 27, 2008 9:35 PM by daflame

Thanks, it saved me too.  I was loadnig all my custom javascipt dropdown boxes with dropdowns that get added outside of the content area, but the script was running inside a DIV tag.  It worked in FireFox and I mostly develop in Linux FireFox, so I didn't notice it until I tried to access the site in IE.  Thanks to you it works again!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, April 28, 2008 10:47 AM by david

This happens with Overlib.js, so I think I must change this library...

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, May 9, 2008 7:00 AM by Lubos Motl

Could you please check my website motls.blogspot.com to see whether it is the same error? Similar window has been appearing to me and people with IE6 and IE7 complain sometimes.

If you also write me an easy innocent fix, it will be appreciated. Lubos dot Motl at Gmail dot com.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Saturday, May 10, 2008 5:04 PM by InfinitiesLoop

Lubos -- I don't get the error. I notice though that your page takes a pretty long time to load, and it seems to be due to the large number of 'widgets' you have on the right column. Its likely one of those causing the error, they are certainly causing slowness.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, May 13, 2008 6:26 AM by tbela99

I've got this error, I used something like $(object).innerHTML = '...' that caused IE crashed.

to fix this (I was using mootools), I had to use domready event.

window.addevent('domready', function () {$(object).innerHTML = '...'; }) and there were no more crashed.

- regards

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, May 21, 2008 3:47 AM by Ali Murat

thanks man its work successfully..

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, May 26, 2008 9:10 PM by Alana

Hi,

I've had the 'operation aborted' come up when i try to open my gmail account. I'm not really computer savvy and don't understand all the jargon that is in the above comments. Is there an easy step by step option to crash IE for an everyday person like me?

Thanks

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, June 11, 2008 9:23 PM by Olajide

On IE, i get the Operation Aborted Error. Can someone help me here? Please.

Thanks.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, June 12, 2008 3:00 PM by illuf

I dont; think so that is based on javascripts.

I have same problem on 2 computers but on 10 another on same configuration (XP, IE6) works fine.

one of 2 problematic compuer was freshly reinstaled, without any installed service pack or any upgrades. WHY this 2 stupid compuers make me crazy? It mostly crashed on my web applications where i used wrapped variables technology (quick redirect on the same page and hide all posted values of variables)

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, June 23, 2008 9:39 AM by mick

Thanks for this. Likely saved me a day of head scratching.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, July 11, 2008 6:16 AM by Amy

Thank you for writing this article!  This is exactly the answer I was looking for!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, July 16, 2008 1:42 AM by Gaurang Pandya

hi,

I am having the same problem. There were script between <body> tag , we removed that. But problem is still that. We are using Menu. Wherever click on menu item. page redirect to next page but still operation Aborted Msg comes. and page lost. We are calling javascript function in body tag. Does it make any different?

Your answer is awaited...

Thanks

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, July 16, 2008 12:52 PM by InfinitiesLoop

Gaurang -- are you sure the error isnt actually coming from the page you are linking to? Theres really no possible way I could help you other than toss ideas at you, without seeing code.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, July 23, 2008 10:45 AM by Fred

Thanks for this. Pages with Google maps tags started playing up - and you've saved me a lot of head scratching.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, August 4, 2008 9:08 PM by Michael

Could someone give me the answer in a novice user's terms? Sorry

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, August 4, 2008 9:12 PM by InfinitiesLoop

Michael -- are you a user of the site or a developer of it? You'd have to be a developer of it to fix it. Many people find this blog entry as end users who get this from various sites, but the problem lies with the site's code.. not with the users machine.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, August 11, 2008 5:07 PM by Dave

Interesting topic.  As InfinitiesLoop said I found this blog because I am an end user and got this error message from a web site (Expedia).  It happens on one computer but not another, so I figured it was the user's computer causing the problem.

I'm still not sure why it's only happening on one computer, but I'll stop looking on my end.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, August 25, 2008 8:57 AM by Roman

Thx a lot for solution.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, August 27, 2008 3:49 PM by MrT

Can you tell us web users (not developers) how we can get around this?  I get this error just opening Google and want to be able to use Google with IE and not only Firefox.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, August 27, 2008 3:53 PM by InfinitiesLoop

MrT -- there isnt anything an end user can do except keep trying, sometimes the error is intermittent. You could also try complaining to the site owner through whatever feedback mechanism they have in place. I'm sure google has something like that, but not sure...

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, September 1, 2008 1:13 PM by swade

I have a webpage that is having this problem (only on one page) (please click the children book illustration navigation button. All the other pages work except this one - however, this page does have a simple veiwer slideshow feature within it. Any help would be grwat.

www.designhousestudios.co.uk

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, September 16, 2008 6:10 AM by Jaya

I am the developer of the site. Works perfect in FF. Am using a js for rotating images from dynamic drive for the frontpage. I keep getting this message whenevr i try to refresh the page. I am using Drupal open source to create the site and hence will not be able to prevent having the js in the body of the page. Is there any other way i can resolve this. Am really in a fix and would greatly appreciate any help. thanks in advance.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, September 18, 2008 12:07 PM by Lissette Ganoza

Hi , I have a same problem but my problem happends when I run a test with Waitj Framework (a extension for Junit to Web automated test) , this page has no problem for anybody but and before I never have Problem.. so this very weird , I need know if someboby has or had this problem.

I use a IE 7 and XP OS.

PLEASE HELP ME!!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, September 23, 2008 12:56 AM by Rizwan

Thanks this is a great post and really help me to solve the issue on IE6+7.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, September 30, 2008 7:07 PM by young webmaster

this is a really great tip I've never seen anywhere else. I've ran into this problem so many times, especially appending a table in a table

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, November 12, 2008 3:26 AM by Samora

I have this same problem "Operation Aborted". this only occurs when I change a filter value in the report. I have tried everyothing. Can someone please help

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, November 13, 2008 1:06 AM by JP

Nice entry. Pointed me in the right direction to trace the Javascript that caused the "Operation aborted" error on IE. :)

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, November 25, 2008 6:46 AM by PRS

If you are still having issues, we had this problem and were using classic asp and solved it by using a 'If' statement.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, November 25, 2008 11:02 PM by Lex

This problem doesn't always happen as described in the Microsoft's KB or here. What I found so far is that it's related to Javascript but not necessary to DOM manipulations. In some cases simply accessing an element may cause this error, that's probably some deeper bug than it appears to be.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, December 9, 2008 11:01 AM by Davin

This is something that is killing me! I don't how to fix this. if you go to my site. www.fineoperaglasses.com and click on any product it will give me this error message... anyone know what is going on in my site?

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, December 30, 2008 9:17 PM by Irritated

So how does this help a person browsing a website? It's annoying to be at a site used by 100's of 1000's of people per day and it pop up everytime you click a link.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, December 30, 2008 10:56 PM by InfinitiesLoop

It doesn't help you if you're just a user of the site, but you could forward this to the site's webmaster and they can fix it :)

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, January 16, 2009 7:36 AM by Mohan

Pls advice to fix operation aborted error when using IE 7.0

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, February 4, 2009 6:39 PM by susan

Now I am really confused re: IE and 'abort operation'. I'no techy tahts for sure but hwo can there be 3 or 4 different HTML codes to use. don't know where to begin and don't want to fool around with it because I'm a rooky. The only thing I did differently was to add plugin (onlywire.com) and then added a child page to a prent page, which acutally doesn't show up anyway. Thanks in advance for any help. Funny my web server people said the site came up no problem. Susan

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, February 4, 2009 7:29 PM by susan

Can I add further to my comment made a an hour or so ago...I wa able to bring the site up in FF okay but in in IE. thanks Susan

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Saturday, March 7, 2009 4:54 PM by Rhonda

I have tried deleting posts and content and still with IE get an 'abort message'  I am able to access with FF and the blog is set up with FF, but those who visit through IE cannot access since my last post.  

Please help me?????  :(

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, March 11, 2009 4:04 AM by Kelly

The defer method worked best for me.

Just use it on your inline javascript as needed.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, March 11, 2009 6:22 PM by InfinitiesLoop

Filip -- setTimeout does not return a function that you call, it returns a token that you can use to clearTimeout. So it seems your code is only working because your setTimeout calls the init function after 200ms, not because it's part of the onload event. What does the code that supposively does not work look like? If you're doing this:

document.body.onload = init_ajax_menu();

Then its not going to work because you aren't assigning the function to call during onload, you're calling the function, and assigning its return value to onload.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, April 1, 2009 3:45 AM by Cardaleel

Thanks,  this was very helpful ... it works now

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, June 4, 2009 2:55 AM by Dileep

ureka!

Thx man this really helped solve my problem.

i wonder how ms couldn't fix this bug since 2006.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, June 17, 2009 3:19 AM by Salman

Well, I have the same problem with my blog. However, I am not sure which fragment of javascript causes this error. Could be caused by scripts that are added by third party ads or the blogging engine. I'm totally confused :(

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, June 23, 2009 10:44 AM by Ian

very helpful, thanks very much.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, July 16, 2009 4:33 PM by karen

What is a simple HTML file and how do you copy and paste that message to it!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, July 29, 2009 5:11 PM by Joe

Saved my life, sir. Thank you.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Monday, September 14, 2009 5:56 PM by Opera Glasses

Hey I got my issue sorted. It makes it so much harder to fix stuff like this when you are using a builder that doesn't let you edit the template coding.

The problem was a java script countdown that was running rampant on my site. As soon as I deleted it, the problem just went away.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, October 6, 2009 6:22 PM by Wishing I had Firefox

But my website doent even use a javascript! Gr!

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, October 7, 2009 7:15 AM by Colm McHugh

Is there any chance this is related to number of users? We've had an application (Javascript, IE 6) in development and test for several weeks, it went live, which meant 500+ new users, and then this error started occuring frequently.

Could it also be related to an environment update? Its a corporate environment (users have no or very little control over their PCs) and am also thinking it could be some update that affected Internet Explorer security, particularly in running JavaScript.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, October 7, 2009 2:22 PM by InfinitiesLoop

Colm --- depending on what is causing it, but it is possible that it is a timing issue due to calls to setTimeout, etc. In that case it might be that users with slower connections, or if the site responds slowly due to load, would be more likely to hit the issue.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Friday, November 20, 2009 1:24 PM by thankful

Thank you so much! I was going crazy until I found your post

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Thursday, January 28, 2010 3:23 AM by Ali

To a website developer, your comments were undoubtedly very useful, however, what is a lame user like me to do? I keep getting this error on a number of websites. I feel it also has something to do with my IE settings.

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Wednesday, August 4, 2010 7:55 AM by Andrei

Thank you.

You saved me hours of head-aching work.

Stupid IE6 :)

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Saturday, August 14, 2010 1:52 PM by interviewpuzzle

while accessing my blog in IE 8 I am also getting the same error. I am also using append child element...

# re: Dealing with IE "Operation Aborted". Or, how to Crash IE

Tuesday, September 28, 2010 8:02 PM by Sandy

Thanks. Solved my problem. Even though the script was "defer", I still had the problem. Fixed by moving to runtime.