I'm keep getting 'Access Denied' when doing XDomainRequest in IE9.
I Have tried lots of different solutions, nothing works so far.
Note: the script is on HTTP while the server it's doing request to is HTTPS
Below is my code:
let xhr = new XMLHttpRequest();
if ('withCredentials' in xhr){
xhr.open('POST', XHR_URL, true);
} else if (typeof XDomainRequest != 'undefined'){
xhr = new XDomainRequest();
xhr.open('POST', XHR_URL);
} else {
xhr = null;
return;
}
xhr.setRequestHeader('Content-type', 'text/plain');
xhr.onreadystatechange = () => {
if(xhr.readyState == 4 && xhr.status == 200) {
// do something
}
}
xhr.onprogress = function () { };
xhr.ontimeout = function () { };
setTimeout(function () {
xhr.send(params);
}, 0);
Need help, Thanks!
If you start on IE9, then your
xhrcalls newXDomainRequest(a.k.a xdr). But,xdrdoesn't have 'setRequestHeader'.