22 February 2006

The dreaded "Operation Aborted" bug in Internet Explorer

I've been brushing up on my JS and DOM work recently after not flexing those coding muscles for a while.  I have some AJAX work on my plate at work and a quick demo a few weeks ago made me realize how much I'd forgotten.

Anyway, some playtime with the Virtual Earth SDK and I ran into a crazy bug.  IE doesn't like it if you try to play with the DOM too much before the page is loaded.  I was adding nodes to a table and got the error described in many places including the Channel 9 IE Bug wiki here and RE: Google Maps API here.  To fix it I used the window.onload method rather than the onload attribute of the body tag.  It's described pretty succinctly on about.com here and in more depth on Simon Willison's blog here.

Basically, I replaced my original call like this:

with this (which is probably better anyway):


window.load = doSomething;

You could also try using:


setTimeout(“doSomething()“, 1);

BTW, maybe this is the same issue - http://support.microsoft.com/?kbid=887560

Filed under:

Comments

No Comments

 

News

Hey, somebody remind me to put something good in this space. :)