Sunday, 18 August 2013

CORS XMLHTTPRequest not working in Chromium 28

CORS XMLHTTPRequest not working in Chromium 28

I am trying to send CORS Ajax requests but it seems to fail :
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://enable-cors.org");
xhr.addEventListener("load", function() { console.log(this.response); });
xhr.withCredentials = true;
xhr.send();
I am making this request from the console, while browsing html5rocks.com.
I get this error message :
XMLHttpRequest cannot load http://enable-cors.org/. Origin
http://www.html5rocks.com is not allowed by Access-Control-Allow-Origin.
I believe enable-cors.org should send back correct
Access-Control-Allow-Origin headers :) But this holds true for any other
website. Also the console tells me an Origin header has been properly sent
in my request. What do I do wrong ?

No comments:

Post a Comment