XmlHttpRequest status 0 instead of 401 in IE 10

前端 未结 2 862
陌清茗
陌清茗 2020-12-09 04:36

I have hit a wall with this issue. I guess it is some kind of IE bug but I want to be sure.

So the question is. Why does IE10 XmlHttpRequest.status returns 0 instead

相关标签:
2条回答
  • 2020-12-09 04:49

    This appears to be a bug in IE10 (https://connect.microsoft.com/IE/feedback/details/785990/ie-10-on-win8-does-not-assign-the-correct-status-to-xmlhttprequest-when-the-result-is-401).

    IE10 is treating HTTP status 401 as a network error. The console shows:

    SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied
    

    According to the XMLHttpRequest Level 2 specification the status attribute should be zero if the error flag is set (for example because of a network error). However the specification also states (http://www.w3.org/TR/XMLHttpRequest2/#infrastructure-for-the-send-method) that a network error

    does not include HTTP responses that indicate some type of error, such as HTTP status code 410.

    I think it is clear that HTTP status 401 should not therefore be treated as a network error (as it is not in Chrome, Firefox and Safari) and that this is a bug in IE10.

    0 讨论(0)
  • 2020-12-09 05:05

    I just ran into this problem today. After trying a few workarounds, and some Googleing, I ended up here. It turned out to just be a security level settings. Whatever security zone your website is in (Internet Options > Security) make sure you ENABLE the following setting in your zone: Miscellaneous > Access data sources across domains.

    0 讨论(0)
提交回复
热议问题