Strange IE Bug (January 11th, 2005)

Today I came across a VERY strange IE bug – a certain page would not work in IE6 under Windows XP SP2, while it worked fine in Opera, Mozilla and Firefox. The message shown would be as follows:

Internet Explorer cannot open the Internet site [url] Operation aborted

After more digging, I came across a post at a Microsoft Wiki:

“Operation aborted”

Apparently interacting with innerHTML and possibly using other 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 sometimes attributed to BHO mal/spyware, but I can confirm it happens with no such software installed. This bug is present in IE SP1 and IE SP2.

http://peterjanes.ca/blog/archives/2003/12/03/hulk-smash

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 Firefox:

  <table> 
   <tr> 
    <td> 
      
      var d = document.createElement('div'); 
      document.body.appendChild(d); 
      
    </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.

Comments?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s