IE, Operation aborted and MSDN

Since writing this post on DOM manipulation about a week ago msdn has crashed on me three times with the dreaded operation aborted exception.  Following Dave Reed's comment here, it looks like this is probably occurring because the call to ASP.NET AJAX's client side initialization function is too far away from the forms closing tag - causing the Sys.Application.init event to fire before the DOM is really ready (view source on one of the pages and you will see what I am talking about).

Here is an excerpt from Dave's comment:

ScriptManager does not put the call to initialize in a “random” location. It is in fact, always the very last thing in the form, just before the closing form tag. There shouldn’t be anything after that (for better or for worse, form is a major part of an asp.net page), and if there is, it could only be because the dev put content after the closing form tag, and all they must do is move it inside

 

I found this interesting and ironic - interesting because here is an 'in the wild' example from a high-traffic site that shows what can happen if you don't wait until the DOM is ready before you start mucking with it.  And ironic because I swear I never ran into this error until after I wrote my previous post.  And of course ironic because it appears that Microsoft is misusing their own framework ;)

image 

 

That's it.  Enjoy!


TrackBack

TrackBack URL for this entry:
http://mattberseth.com/blog-mt/mt-tb.fcgi/146

Comments


That's freaking hilarious in an ironic foot-in-mouth kind of way.

What a strange way to do it, I always used this to actually attach to the page load event:
//set page event handlers
if (window.attachEvent) {
window.attachEvent("onload", Page_Load);
} else {
window.addEventListener("DOMContentLoaded", Page_Load, false);
}
John.

Posted by: Igor Loginov on August 19, 2008 04:43 AM

Matt,

A really impressive confirmation of your point. And a kind of maturity indicator for JS framework developers.

Matt,

I've seen this error before, but only in IE6. We had some code that was doing a document.write in a script block registered using Page.RegisterStartupScript. The solution turned out to be wrapping the document.write calls in a function, then call the function as an event handler wired up using the Sys.Application.add_init() method. I never saw the problem in IE7 or FF.

-Mark

Posted by: Kev on August 20, 2008 08:29 AM

I get the 'Operation aborted' error with GMail + IE7 quite frequently. Drives me potty. And before the FireFox fans get going, no I won't switch to FF.

Posted by: Kimberly Wolk on August 20, 2008 11:07 PM

Matt,

We've tracked down the issue on the MSDN site as caused by one of our control's js functions updating innerHtml. It is hitting an IE problem documented here: http://blogs.msdn.com/ie/archive/2008/04/23/what-happened-to-operation-aborted.aspx. I believe the sample in the blog you refer to in your post is hitting the same issue. We are working on a fix now.

Thanks for calling out the problem,


-kim

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Consulting Services

Yep - I also offer consulting services. And heck, I'll do just about anything. If you enjoy my blog just drop me an email describing the work you need done.

Recent Comments

  • Kimberly Wolk wrote: Matt, We've tracked down the issue on the MSDN site as caused by one of our control's js functions ...
  • Kev wrote: I get the 'Operation aborted' error with GMail + IE7 quite frequently. Drives me potty. And before t...
  • Mark Hildreth wrote: Matt, I've seen this error before, but only in IE6. We had some code that was doing a document.writ...
  • Igor Loginov wrote: Matt, A really impressive confirmation of your point. And a kind of maturity indicator for JS frame...
  • John wrote: What a strange way to do it, I always used this to actually attach to the page load event: //set pag...
  • Joel Rumerman wrote: That's freaking hilarious in an ironic foot-in-mouth kind of way....