I'm trying to open a (cross domain) uri in my JavaScript code. I'm able to open it if I copy it to my browser and directly open it. However, if I open it in my JavaScript code, I get 403 Forbidden error. Here is my code:
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.withCredentias = true;
xhr.open('get', uri, 'true');
xhr.onload = function() {
console.log(xhr.response);
}
xhr.send();
It doesn't seem like a CORS error, because in the response header I can see my origin host in the Access-Control-Allow-Origin part. I didn't get any CORS error either.
Does anyone have any idea why this happens? Really appreciate your help!
Thanks!
Aucun commentaire:
Enregistrer un commentaire