views:

377

answers:

3

Hello StackOverflow!

First of all, I've been researching this "Operation Aborted" error / bug for what seems like weeks, so here are a couple related questions and good articles if you are not familiar with it:

Why does ASP.NET cause the “Operation Aborted” Error in IE7? (so question)
Detecting cause of IE’s Operation Aborted Issue (so question)
Official Microsoft Knowledge base
Official IE Blog

Now here's my problem:

First I tried moving all my <script> elements to the end of my body tag. Didn't work. Then I refactored all my js functions to an external file that is linked in the <head>, all of my js functions are called from onclick or onkeypress anyway. Still getting the error. The last line of one of my .js files is

document.onload = setTimeout("foo()",500);

so I moved that to <body onload="setTimeout('foo()',500);">. I'm still getting this error. I don't know what to do. The only place I'm editing DOM elements is in foo(). Please help!

About my setup:

Java, Hibernate, Struts, JSPs ... I think that's all that is relevant.

What am I missing here?

Thanks in advance.

+2  A: 

There are several causes for this. Two of the most common are:

1) scripts attempting to modify the DOM before the document has completely loaded

2) Trailing commas in object or array declarations

Number two is usually relatively easy to find, while number one is much tougher. Generally the best way to track down IE Javascript problems is to install Microsoft Script Debugger, so at least you can see what lines are causing the problem. With Script Debugger, IE will halt execution inside the browser and kick the script to a Script Debugger console, which will show the problem line. Much more informative than regular IE error messages.

zombat
As an aside, I ran into this with a Facebook application utilizing MooTools. It was usually a problem with code running inside the 'domready' event. 90% of the time the fix was to move the code to an 'onload' event, which fires much later after the entire document is ready to go, and not just the dom.
zombat
Visual Studio (Web Developer Express is free if you don't have the full version) tends to work more reliably for me than the script debugger. A short HOWTO: http://www.berniecode.com/blog/2007/03/08/how-to-debug-javascript-with-visual-web-developer-express/
steamer25
@steamer25 - ooh! shiny!
zombat
Thanks zombat. I installed MS Script Debugger, and I haven't gotten the operation aborted error since. Unfortunately, the error just stopped happening. I tried disabling all third party add-ons (tools > internet options > advanced) and the problem was still gone. Now I have no idea what I did to fix it. I'm thinking it must have been some sort of cashing error where IE didn't actually refresh properly (even though view source was updated?) I'm stumped. Going to release it to my team of testers to see if they get the error. Thanks!
Peter Di Cecco
Hmm, glad to hear it's not longer a problem. Hopefully it won't come back!
zombat
A: 

That problem can be a bear on a large page. Beyond the advice in the articles you already have, the only thing I can suggest from here is to remove wide swaths of the page in a dev environment until the problem goes away. Keep refining what is/is not on the page until you know which piece of content is causing the problem.

I've actually seen a confluence between two unrelated page elements cause this problem. I don't remember excisely why but the above approach, although painstaking, still worked.

steamer25
My last resort... hope it doesn't come down to this...
Peter Di Cecco
+1  A: 

Please see my answer to this question in another thread. I love this little trick and it has never failed me (when the cause is DOM manipulation before IE is ready, I mean). And as written, it doesn't affect the DOM-compliant browsers.

pluckyglen