Home > Bugs > Error: Internet Explorer cannot open the Internet site Operation aborted

Error: Internet Explorer cannot open the Internet site Operation aborted

Apparently interacting with innerHTML
JScript functionality causes IE to pop up “Internet Explorer cannot open the Internet site http://example.com. Operation aborted.” messages after loading a page.

This is generally caused by DOM operations gone wrong.

I was having this problem trying to put some html inside a DIV tag using innerHTML and solved the problem by puting the DIV inside a TABLE. Sample code for “Operation aborted”

This sample code will give you the “Operation aborted” error in IE6, while it works as expected in Opera, Mozilla and Firefox:

  <table>
   <tr>
    <td>
     <script type="text/Javascript">
      var d = document.createElement('div');
      document.body.appendChild(d);
     </script>
    </td>
   </tr>
  </table>

If the script part is moved outside the table it works in both IE6 and Firefox. (Emphasis added) It seems that this problem is caused by the fact that the SCRIPT block operating on innerHTML or DOM structures is located inside a TABLE tag. I moved the SCRIPT tags outside the TABLE tag, and viola – that fixed the problem.

Peter Janes pointed out in the comments that the issue is deeper than that, it seems to be related to the timing issues with DOM rendering.

I am going to leave it for now unless I see other problems, but using setTimeout or some other way of doing things is not out of the question.

One more way The defer attribute

The W3C HTML 4.0 specification specifies the defer attribute for script tags:

<script language=”javascript” type=”text/javascript” defer>

Originally, this is nothing more than a hint to the browser that the script inside the tags does not modify the content of the web page (by doing a document.write, for instance). Therefore the browser does not need to wait for the entire script to be parsed and evaluated, it can immediately go on parsing the HTML. On older systems this might save some parsing time.(Only in Explorer 4+ on Windows the defer attribute defers executing the script until the document has been parsed completely.)

However, Explorer 4+ on Windows has slightly changed the meaning of defer. Any code inside deferred script tags is only executed when the page has been parsed entirely. For instance, take

<body>
<script language=”javascript” type=”text/javascript” defer>
<!–
alert(document.forms[0].elements.length);
// –>
</script>

<form>
<input value=”Bla”>
</form>
</body>

Normally the alert would give an error: the document does not (yet) contain any form at the moment it is executed. By adding defer to the script tag, however, the alert is deferred until after parsing and correctly gives 1 as the length of the form.

Categories: Bugs
  1. May 11, 2007 at 11:21 am | #1

    Yes ! preetul you are right.As this script will try to create “div” tag under “body” tag according to the DOM level parsing.It should be out of the table.Thanks for posting such error message.I hope it will really help us to learn to take care of such bugs.
    Uttam.

  2. preetul
    June 6, 2007 at 8:54 am | #2

    After reading some articles I come to know:

    This is just an odd error message that you get when loading a page. If you have a script inside a form, and the script calls createElement while the page is loading, Internet Explorer fails to load the page.

  3. KolA
    November 15, 2007 at 4:48 pm | #3

    Thanks you very much for your post! :-) I was struggling with this error last 2 hours. (it appears after bringing site alive, not in develop environment)

  1. May 18, 2007 at 11:27 pm | #1