views:

1221

answers:

5

My site is suffering from the Operation Aborted error. What I find weird is that in my case the error only sometimes happens. The site has been running fine for three months then today it starts happening but not every time.

The page this is occuring on is rather large with a lot of third party controls. What I'd like is a tool that could pinpoint where the failure is occuring. Seems like the best I can do is find the first javascript error that occurs after the operation aborted; however, this doesn't help much. This failure is because an element of the dom isn't available which I'd expect since IE stopped parsing the HTML.

Any one have any ideas or tricks to narrow this down?

Edit

I appreciate additional ways to resolve the issue; however, what I am looking for is a way to identify which script is causing the issue.

Final Edit

After switching to IE8, I was able to determine the cause was the AjaxControl Toolkit's modal popup dialog. There was no concrete way to determine this which is dissapointing, but the debugger let me see where it was failing which was very consistent. Since there is no way in the control to tell it to move its initialization, I disabled it, and have the script to create the client side control in my document load event handler.

This issue is no fault of the control, it was occuring because the content for the popup is actually in a second form. Frankly I'm surprised it ever worked.

+2  A: 

Do you have any javascript that is manipulating the DOM, as the case is described at http://support.microsoft.com/kb/927917#more_information ?

Try moving all script blocks to the very bottom of the page, just before the </body> tag, and don't try to set the innerHTML property of the body tag itself.

If the problem is with javascript executing before the DOM is fully built, try moving any initialization calls into a function that will run only after the page is fully loaded. So, instead of something like this:

<div class="myWidgetControl"/>
<script type="text/javascript">
  initializeWidgets();
</script>

Try something like this:

<div class="myWidgetControl"/>
<script type="text/javascript">
  $(document).ready(
    function () { initializeWidgets(); }
  );
</script>
pkaeding
That's the problem, I am personally not doing this, but I have no idea, if the ComponentArt Grids, Dialogs, Callbacks, Ajax toolkit dialogs etc etc etc are doing this.
JoshBerke
The first javascript error I am getting is from Ajax control toolkit registration of a popup. its failing because $get(element) is null so were not even modding the dom here...
JoshBerke
Okay, I just added an example of how you might be able to get around that problem. Does that help at all?
pkaeding
I should mention, that example uses JQuery, but you can use any method you liek to register an event tot he body's onload event.
pkaeding
Not really cause I'm not sure what javascript is causing the issue and a lot of the javascript is emited by my server side controls, which is why I can't easily just move all the script to the bottom. If I can pinpoint who the offender is then I can work around him remove him etc etc...
JoshBerke
And I use $(document).ready to initalize a lot of stuff already that I've written
JoshBerke
Can you remove the controls, one-by-one to try to isolate the culprit?
pkaeding
Since I could only reproduce this on production wasn't really an option not to mention we are talking about a ton of controls and removing them changes the structure of the page....I think I found it..Ajax Toolkit's Popup's initialize function calls appendChild on the dom.
JoshBerke
cool, I'm glad you found it!
pkaeding
we'll see if I did...hard to tell when the error only happens every so often...
JoshBerke
+1  A: 

This is a nifty trick I used (based on the link in the JS comments below) that completely avoids the Op Ab error without affecting performance in other browsers. You first wrap whatever script you're doing that can cause the error (for instance, loading/instantiating a 3rd-party widget) in a function, then call that function within the delayExecutionForIE function -- note that the call to myFunction is in there twice, once for IE and once for nice browsers.

Your 3rd-party script might prevent this working, depending on exactly what it does and how it expects to be loaded, but it's definitely worth a try.

function delayExecutionForIE() {
      if ( typeof document.all == "object" && 
           (document.readyState != "loaded" 
           && document.readyState != "complete") 
         ) {
            try {
                  //If IE is used, use the trick by Diego Perini
                  //http://javascript.nwbox.com/IEContentLoaded/
                  document.documentElement.doScroll("left");
                  myFunction();
            } catch(error) {
                  setTimeout(delayExecutionForIE, 200);
            }
      } else {
            myFunction();
      }
}

function myFunction() {
    //this is your function that manipulates the DOM
}

delayExecutionForIE();
pluckyglen
A: 

Although IE8 will no longer cause that error to "crash" the rendering entirely, instead logging an error, it is unfortunately not caught by the JavaScript debugger found in the new Developer Tools, and the error message doesn't tell you where the error really occurred.

A workaround, which is certainly tedious, but could locate the issue, is to use IE8's debugger to put a breakpoint on the very first piece of JavaScript code that is run, and then continue hitting the "Step" button until the error icon pops up in the bottom left corner of the browser. When that happens, you know the line of code that causes the error was the one highlighted just before you clicked step. It's likely to be quite a bit of code you'll be stepping through, though, but I can't think of anything else (well, except contacting the vendors of that 3rd party code and seeing if they have any updates that might be related).

Of course, you could just tell your users to upgrade to IE8. ;)

Michael Madsen
Well I upgraded to IE8 and although it no longer errors out when the error occurs I loose critical functionality in the app. I have a good idea what is causing the issue now, just need to try and prove it. Thanks for the additional info
JoshBerke
A: 

And Microsoft does recommend upgrading to IE8!

+1  A: 

You can use script provided by IE Blog to investigate the problem. See: http://blogs.msdn.com/ie/archive/2009/09/03/preventing-operation-aborted-scenarios.aspx

Robert.K