Prevent redirection of Xmlhttprequest

Not according to the W3C standard for the XMLHttpRequest object (emphasis added):

If the response is an HTTP redirect:

If the origin of the URL conveyed by the Location header is same origin
with the XMLHttpRequest origin and the
redirect does not violate infinite
loop precautions, transparently
follow the redirect
while observing
the same-origin request event rules.

They were considering it for a future release:

This specification does not include
the following features which are being
considered for a future version of
this specification:

  • Property to disable following redirects;

but the latest specification no longer mentions this.

Leave a Comment