本文介绍了WebSocket到localhost无法在Microsoft Edge上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的WebSocket服务器,并尝试使用以下代码连接到它:

I've created a simple WebSocket server and am trying to connect to it with the following code:

function test(name) {
    var ws = new WebSocket('ws://localhost:1234');
    ws.onopen = function () {
        ws.send('Hello from ' + name);
    }
}
test('Edge');

这适用于Windows10上的Chrome和IE11,但是当我尝试使用Edge时, onopen 函数未被调用,而是最终我得到以下错误:

This works fine from Chrome and IE11 on Windows10 but when I try from Edge, the onopen function isn't called, instead I eventually get the following error:

版本 12.10240 边缘

有人问及类似的问题但错误信息不同。

A similar problem was asked about here but the error message is different.

我尝试过的事情:


  • 编辑:正如tresf指出的那样,环回about:flags中的复选框似乎已停止工作(作为修复),因此您将使用CheckNetIsolation命令,以使Edge免除。

    As tresf pointed out below, the loopback checkbox in the about:flags appears to have stopped working (as a fix), so you'll have use the CheckNetIsolation command, to make Edge exempt.

    这篇关于WebSocket到localhost无法在Microsoft Edge上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 23:01
查看更多