IE https CORS XHR request fails with Script7002: XMLHttpRequest: Network Error 0x2eff

旧城冷巷雨未停 提交于 2019-12-29 07:45:26

问题


In all other non-IE browsers, the following code snippet works great:

<!DOCTYPE html>
<html>
<script type="text/javascript">
var xhr = new XMLHttpRequest();
var url = "https://otherdomain.com";
var method = "GET";
xhr.open(method, url, true);

xhr.onload = function() {
 var responseText = xhr.responseText;
 document.write(responseText);
};

xhr.send()

</script>
</html>

In two different IE11 browsers (running on different OS versions), I get two different errors:

  1. IE11 Win7: Script7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
  2. IE11 Win8: Script7002: XMLHttpRequest: Network Error 0x2eff Could not complete the operation due to error 00002eff

Google searches for the above error codes don't turn up anything useful. I've tried setting Content-Type, adding dummy functions for onprogress and onload, to no avail.


回答1:


Figured it out.

In our case, on a previous project we had changed which SSL protocols were allowed by IE to us. Ajax requests were failing because IE was not allowed to negotiate the SSL handshakes based on the custom configuration.

Solution was to open up Internet Options, choose the Advanced tab, and then click the "Restore Advanced Settings" button. After that the Ajax requests worked fine.

Hopefully this saves someone else the 6 hours or so I spent on this!



来源:https://stackoverflow.com/questions/25922043/ie-https-cors-xhr-request-fails-with-script7002-xmlhttprequest-network-error-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!