IE9 jQuery AJAX with CORS returns “Access is denied”

This is a known bug with jQuery. The jQuery team has “no plans to support this in core and is better suited as a plugin.” (See this comment).
IE does not use the XMLHttpRequest, but an alternative object named XDomainRequest.

There is a plugin available to support this in jQuery, which can be found here:
https://github.com/jaubourg/ajaxHooks/blob/master/src/xdr.js

EDIT
The function $.ajaxTransport registers a transporter factory. A transporter is used internally by $.ajax to perform requests. Therefore, I assume you should be able to call $.ajax as usual. Information on transporters and extending $.ajax can be found here.

Also, a perhaps better version of this plugin can be found here.

Two other notes:

  1. The object XDomainRequest was introduced from IE8 and will not work in versions below.
  2. From IE10 CORS will be supported using a normal XMLHttpRequest.

Edit 2: http to https problem

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.

Source: http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx

Leave a Comment