Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access is denied error on XDomainRequest

I'm trying to use microsoft XDomainRequest to send cross domain request. Here is the code

...
if ($.browser.msie && window.XDomainRequest) {
  // Use Microsoft XDR
  var xdr = new XDomainRequest();
    xdr.open("POST", "http://graph.facebook.com/1524623057/");

  xdr.send();
} 
 ....

It gives SCRIPT5: Access is denied. error on xdr.open(...) line.

like image 372
narek.gevorgyan Avatar asked Dec 11 '11 13:12

narek.gevorgyan


1 Answers

I found the reason of this problem. As stated in Point 7:

Requests must be targeted to the same scheme as the hosting page

This restriction means that if your AJAX page is at http://example.com, then your target URL must also begin with HTTP. Similarly, if your AJAX page is at https://example.com, then your target URL must also begin with HTTPS.

like image 139
narek.gevorgyan Avatar answered Oct 07 '22 13:10

narek.gevorgyan