I try to build a simple wrapper function for making CORS Ajax requests in IE 8:
function getCORS(url, success) {
var xhr = new XDomainRequest();
xhr.open('GET', url);
xhr.onload = success;
xhr.send();
return xhr;
}
getCORS('http://foo.com/?q=test', function(request){
console.log(request.currentTarget.response || request.target.responseText);
});
However, IE 8 returns "Access denied", although CORS requests in modern browsers using 'XMLHttpRequest()' work properly. Any idea?