After this update of Google Chrome for version 53, I am facing problems in the Ajax (jQuery), $ .http (AngularJS) and XMLHttpRequest (Javascript) calls with the following message:
XMLHttpRequest cannot load *. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '*' is therefore not allowed access. The response had HTTP status code 400.
In similar call of another service, with the same characteristics, I received the following message:
XMLHttpRequest cannot load *. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '*' is therefore not allowed access. The response had HTTP status code 405.
An example call is as follows:
var data = JSON.stringify(false);
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("PUT", "*");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
I also can not run in Firefox and Internet Explorer, but before it worked in Chrome, when I make the calls in the Postman or Backend method they are executed correctly.
I'm facing this problem because I'm implementing one of the api's on a landing page with no backend, so I need to use only Javascript call or jQuery page.
Can anyone help me?