Wednesday, March 07, 2007

Internet Explorer - Operation Aborted ?

If you are using a Javascript framework like YUI, you may encounter problems with Internet Explorer 6 spews the "Operation Aborted" errors.

This error occurs because

1. IE loads the entire HTML including Javascript the first time it loads data
2. When you try to refresh the page, IE would have cached some of the Javascript files which try to execute on a HTML page which isn't loaded fully yet
3. IE thinks its illegal to do the above operation and throws up the error.

The way to fix is to move your Javascript which tries to modify the DOM structure to the end of the html page and just before body tag ends. And thankfully, it doesn't affect any other browsers although you end up with some horrible html code

1 comment:

Nick Clarkson said...

in the case of YUI you can use the following event to trigger you code:

YAHOO.util.Event.onDOMReady(function(){

...your code here...

});