Reputation: 121
IE suddenly started throwing this "Access is denied" error with XDomainRequest and I can't figure out what the hell is going on. Here's what I have:
if ($.browser.msie && window.XDomainRequest) {
// Use Microsoft XDR
var xdr = new XDomainRequest(),
url = 'http://someurl.com/x=1&y=2';
xdr.open("get", url);
xdr.onload = function () {
doTheThing();
};
xdr.onprogress = function(){ };
xdr.ontimeout = function(){ };
xdr.onerror = function () { };
setTimeout(function(){
xdr.send();
}, 0);
}
The error goes with the xdr.open("get",url), the weird thing is that this code was working fine and this solution is used everywhere I searched.
Upvotes: 1
Views: 1519
Reputation: 2515
There are restrictions in using XDomainRequest. If your page happens to be in https and your target is http, then you will get this error.
Take note that requests must be targeted to the same scheme as the hosting page. This restriction deliberately prevents HTTPS pages from making XDomainRequests for HTTP-based resources
More details can be found here:
Upvotes: 2