By fiddling it seems IE11 does not make an ajax request if it is cross origin. FF and Chrome will at least make the request and throw an error if the resource API is not sending necessary headers. The resource API (Web API 2.0) in my case is adding required headers which will be helpful IF IE makes the request, but it doesn't.
Client's JavaScript:
jQuery.support.cors = true;
$.fn.somePlugin = function () {
$.ajax({
url: apiUrl + '/articles/list/',
type: 'GET',
crossDomain: true
}).done(
function (data, textStatus, xhr) {
console.log('hello world!');
});
return this;
}
The ajax request above works perfectly in Chrome and FF but not in IE11.
I've tried:
- adding a reference to XDomainRequest.js without any effect.
- enabling cross origin request in IE Security options - even though it seems bizarre to do this on every client machine. Regardless, it made no difference.
I was having the same problem. I was unable to retrieve any CORS data using XMLHttpRequest(), $.ajax() or $.ajax shortcuts. The problem turned out to be localhost (IIS WinPro7). Every AJAX CORS request was preflighted which generated an
error, followed by
When I moved the HTML page to a webserver it worked fine.