IE https CORS XHR 请求因 Script7002 失败:XMLHttpRequest:网络错误 0x2e

2023-05-14前端开发问题
166

本文介绍了IE https CORS XHR 请求因 Script7002 失败:XMLHttpRequest:网络错误 0x2eff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

在所有其他非 IE 浏览器中,以下代码片段效果很好:

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>

在两个不同的 IE11 浏览器(在不同的操作系统版本上运行),我得到两个不同的错误:

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

  1. IE11 Win7:Script7002:XMLHttpRequest:网络错误 0x80070005,访问被拒绝.
  2. IE11 Win8: Script7002: XMLHttpRequest: Network Error 0x2eff 由于错误 00002eff 无法完成操作

Google 搜索上述错误代码并没有找到任何有用的信息.我尝试设置 Content-Type,为 onprogress 和 onload 添加虚拟函数,但无济于事.

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.

推荐答案

想通了.

在我们的案例中,在之前的项目中,我们更改了 IE 允许我们使用的 SSL 协议.Ajax 请求失败,因为不允许 IE 根据自定义配置协商 SSL 握手.

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.

解决方案是打开 Internet 选项,选择高级"选项卡,然后单击恢复高级设置"按钮.之后,Ajax 请求运行良好.

希望这可以节省我花在这上面的 6 个小时左右的时间!

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

这篇关于IE https CORS XHR 请求因 Script7002 失败:XMLHttpRequest:网络错误 0x2eff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

ajax请求获取json数据并处理的实例代码
ajax请求获取json数据并处理的实例代码 $.ajax({ type: 'GET', url: 'https://localhost:44369/UserInfo/EditUserJson',//请求数据 data: json,//传递数据 //dataType:'json/text',//预计服务器返回的类型 timeout: 3000,//请求超时的时间 //回调函数传参 suc...
2024-11-22 前端开发问题
215

js删除数组中指定元素的5种方法
在JavaScript中,我们有多种方法可以删除数组中的指定元素。以下给出了5种常见的方法并提供了相应的代码示例: 1.使用splice()方法: let array = [0, 1, 2, 3, 4, 5];let index = array.indexOf(2);if (index -1) { array.splice(index, 1);}// array = [0,...
2024-11-22 前端开发问题
182

layui 实现实时刷新一个外部的div
主页面上显示了一个合计,在删除和增加的时候需要更改这个总套数的值: //html代码div class="layui-inline layui-show-xs-block" style="margin-left: 10px" id="sumDiv"spanSOP合计:/spanspan${totalNum}/spanspan套/span/div 于是在我们删除这个条数据后,...
2024-11-14 前端开发问题
156

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui laydate日期时间范围,时间默认设定为23:59:59
在Layui中,如果你想设置日期时间选择器(datetime)的默认结束时间为当天的23:59:59,你可以使用如下代码: laydate.render({ elem: '#test10' ,type: 'datetime' ,range: true ,max: '{:date("Y-m-d 23:59:59")}' ,ready: function(date){ $(".layui-laydat...
2024-10-24 前端开发问题
279

JavaScript(js)文件字符串中丢失"\"斜线的解决方法
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17 前端开发问题
437