Is it possible to send an xhr HTTP HEAD request to only get header response for the first request and not automatically follow 301, 302 like redirects? I'm only interested in getting the new location of the url. Example:
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(data) {
if (xhr.readyState == 4) {
if (xhr.status == 301 || xhr.status == 302) {
// Get new location url don't GET it
}
}
};
xhr.open('HEAD', url, true);
xhr.send();
http://www.w3.org/TR/XMLHttpRequest/#infrastructure-for-the-send-method seems to specify that requests should be followed, is there a way to stop this?