Internet Explorer 11 does not add the Origin header on a CORS request?

Internet Explorer’s definition of the “same origin” differs to the other browsers. See the IE Exceptions section of the MDN documentation on the same-origin policy: Internet Explorer has two major exceptions when it comes to same origin policy: Trust Zones: if both domains are in highly trusted zone e.g, corporate domains, then the same origin … Read more

jQuery AJAX fires error callback on window unload – how do I filter out unload and only catch real errors?

In the error callback or $.ajax you have three input arguments: function (XMLHttpRequest, textStatus, errorThrown) { this; // options for this ajax request } You can check directly the xhr.status to get the HTTP response code, for example: $.ajax({ url: “test.html”, cache: false, success: function(html){ $(“#results”).append(html); }, error: function (xhr, textStatus) { if (xhr.status == … Read more

Best method: Access-Control-Allow-Origin Multiple Origin Domains

The documentation on this seems to imply that it allows multiple origins with a space separated list, but that’s not what it actually means. Here’s what I could gather as the most definitive answer to your question: the Access-Control-Allow-Origin header should be the same value as the Origin header as long as you want to … Read more

How do you send a custom header in a CORS preflight OPTIONS request?

Your problem isn’t with jquery, it’s in how CORS works. Your beforeSend callback was probably working as expected… but browsers won’t send custom headers in preflight requests, no matter what. This is by design; the purpose of the preflight request is to determine what information the useragent (browser) is permitted to send beyond the “simple” … Read more

How to force a program to wait until an HTTP request is finished in JavaScript?

EDIT: Synchronous requests are now deprecated; you should always handle HTTP requests in an async way. There is a 3rd parameter to XmlHttpRequest‘s open(), which aims to indicate that you want the request to by asynchronous (and so handle the response through an onreadystatechange handler). So if you want it to be synchronous (i.e. wait … Read more

How to make Microsoft XmlHttpRequest honor cache control directive

Unfortunately the XMLHttpRequest object was designed this way, because it is based on WinInet. Also, it is not recommend to be used from the server side. You should use ServerXMLHttpRequest, which has the same functionality, but depends on WinHTTP instead. See the FAQ for more information. A description from the ServerXMLHttp documentation states that: The … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)