是否可以在发送 XMLHttpRequest-s 时阻止浏览器跟随重定向(即获取重定向状态代码并自行处理)?
最佳答案
不符合 the W3C standard for the XMLHttpRequest object (强调):
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.
它们是 considering它用于将来的版本:
This specification does not include the following features which are being considered for a future version of this specification:
- Property to disable following redirects;
但是latest规范不再提及这一点。
关于javascript - 防止重定向 Xmlhttprequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/228225/