Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix 'Operation aborted' error message in some versions of IE6. #122

Closed
wants to merge 2 commits into from

6 participants

@rolftimmermans

When using Respond.js at the end of the body element, some versions of IE will abort loading of the site with the message "Operation aborted". The site will not be rendered at all after this error occurs. This appears especially common with IE versions installed with tools such as MultipleIE.

This error is caused when the DOM is changed before the document is completely parsed. Attached is a fix, which just waits for the DOM ready event to fire if necessary.

@scottjehl
Owner
@rolftimmermans

No, just one

@mathiasbynens
Collaborator

Relevant: more info on the “operation aborted” error in IE: http://mths.be/ieoa

@georgeadamson

FWIW, I've experienced this problem using RespondJS in Microsoft's IE6-XP VM for Parallels downloaded from http://www.modern.ie/en-US/virtualization-tools. Eventually solved by downloading latest version of respondjs but at the time, moving my modernizr.js script tag to be after the respond.js script tag seemed to help.

@craigfrancis

Patch by @rolftimmermans seems to fix the issue for me, although does cause a little flicker (oh well, it's only IE).

@jefflembeck
Collaborator

If this is still happening for anybody, please file an issue and include a simple example page where it is occurring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 1 deletion.
  1. +12 −1 respond.src.js
View
13 respond.src.js
@@ -308,7 +308,18 @@ window.matchMedia = window.matchMedia || (function(doc, undefined){
})();
//translate CSS
- ripCSS();
+ if( document.attachEvent && document.readyState !== "complete" ){
+ // Avoid "Operation aborted" error in IE6 by waiting until the DOM is loaded.
+ var DOMLoaded = function() {
+ if( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", DOMLoaded );
+ ripCSS();
+ }
+ };
+ document.attachEvent( "onreadystatechange", DOMLoaded );
+ } else {
+ ripCSS();
+ }
//expose update for re-running respond later on
respond.update = ripCSS;
Something went wrong with that request. Please try again.