Wednesday, August 06, 2008

Internet Explorer Cannot Open the Internet Site ... Operation Aborted.

You usually get this using an Internet Explorer version 6 (but also later versions might exibit this) on pages that seem to be loading ok in the background. You press ok and the page disappears and the regular error page is displayed.

What is happening is that javascript is trying to change a html element that has not finished loading. The usual cause of this problem is an embedded script block that executes as it loads, rather than on the onload event of the page.

The fix is easy. Take all the scripts that execute as they load and either mark them as defer or encapsulate those commands in a function that is executed on the onload event of document.body. Be careful with defer. This post describes the various implementations of the keyword in various browsers.


Sturdy said...

But isn't there a solution, a patch or fix, those unfamiliar with java script and code could use? This problem seemed to start when I installed IE8, then uninstalled it, not sure about that though. I've read numerous sites about this issue and a simple answer I've yet to see.

Siderite said...

As I said, the solution is simple for someone who adds javascript to a site. It's their job :) If they don't know much about javascript, they should not use it.

A simple solution is this:
- add
function startFunction() {
before all these embedded javascript blocks
- add

after them. It is far more elegant and safe to use an addHandler option, but if it is a simple site and you don't know javascript, that should do it.