javascript - Microsoft Edge 阻止发送到同一专用网络 CIDR 中的 IP 的跨域请求

标签 javascript ajax xmlhttprequest cors microsoft-edge

$.ajax({
    url: "http://10.13.22.150/req_path",
    success: function(result){
        console.log(result);
    }
});

我想将跨域 XMLHttpRequest 发送到专用网络中的 IP 地址。 但是,开发者工具控制台中显示以下错误:

SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd.

根据Wireshark的说法,数据包不是从客户端发送的。我猜该请求已被 Microsoft Edge 阻止 此外,我发现只有当 XMLHttpRequest 和 Edge 客户端的 url 位于同一私网 CIDR 中时,请求才会被阻止。

Client IP             Request URL            Result
192.168.x.x  send to  192.168.x.x   ->>>>>   X
10.13.x.x    send to  10.13.x.x     ->>>>>   X
10.13.x.x    send to  192.168.x.x   ->>>>>   O

其他浏览器(例如 IE11/Chrome/Firefox)也可以正常工作。这种情况仅在 Microsoft Edge 中出现。 对于这个问题有什么解决办法吗?

最佳答案

来自Understanding Enhanced Protected Mode

Private Network resources

Because EPM does not declare the privateNetworkClientServer capability, your Intranet resources are protected from many types of cross-zone attacks (usually called “Cross-Site-Request-Forgery (CSRF)” and “Intranet Port Scanning.”) Internet pages are not able to frame Intranet pages, load images or resources from them, send them CORS XHR requests, etc.

以上所有内容似乎都适用于 MS Edge。 Edge 唯一缺少的东西(至少在这一点上,v20.10240)是安全区域设置。

我的问题不在于 XMLHttpRequest,而在于尝试在互联网页面内的 iframe 中加载 Intranet 页面。解决方法涉及更改我的网络设置 - 请参阅 https://stackoverflow.com/a/32828629

关于javascript - Microsoft Edge 阻止发送到同一专用网络 CIDR 中的 IP 的跨域请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35293904/

相关文章:

javascript - 使用 if 语句使 div 淡入淡出

javascript - Youtube:提高页面加载速度(Greasemonkey/jQuery)

javascript - 用于验证手动插入的数据并在末尾给出消息的表

javascript - 如何每隔几秒在php中刷新一个具有打印语句和图像功能的div

javascript - 你如何使用pdf.js获取客户端存储的pdf的文本内容?

internet-explorer - JScript/VBscript : Tracking file download progress via XMLHttpRequest

javascript - 如何在 Firefox 中从 JavaScript 解析 HTML?(2)

javascript - jQuery $.get() 不运行 php 脚本

javascript - 如何停止 ajax 调用中执行的所有 JavaScript?

javascript - 当 API 不允许 Access-Control-Allow-Origin 时该怎么办