-
-
Save nicolaihald/9783212 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// override default jQuery transport for IE | |
if(window['XDomainRequest']) { | |
// save default xhr | |
jQuery.ajaxSettings.xhr_back = jQuery.ajaxSettings.xhr; | |
jQuery.ajaxSettings.xhr = function() { | |
if(this.crossDomain) { | |
try { | |
// IE sucs | |
var xhr = new window.XDomainRequest(); | |
xhr.onload = function() { | |
setTimeout(function(a,b,c) { | |
xhr.readyState = 4; | |
xhr.status = 200; | |
xhr.getAllResponseHeaders = function(){return '';} | |
xhr.onreadystatechange.apply(this, arguments); | |
}, 22); | |
}; | |
return xhr; | |
} catch(e) {} | |
} | |
// return original xhr | |
return jQuery.ajaxSettings.xhr_back.apply(this, arguments); | |
}; | |
// also, override the support check | |
jQuery.support.cors = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment