November 06, 2009

IE and heinous "operation aborted" error

We ran into a heinous bug in IE regarding using Javascript to modify the DOM while the page is loading. It turns out that IE6 and IE7 will show a modal error dialog and then clear the page when the user dismisses the error message. On IE8 it was fixed to merely stop rendering the page at that point. How helpful.

You can find out more here on an MDSN blog

If you are unable to defer Javascript execution until after the page finishes loading, the following snippet may work in your use case.

var tags = document.getElementsByTagName("*");
tags[tags.length-1].parentNode.appendChild(n);

No comments: