IE10上的WebSocket给出了一个SecurityError [英] WebSocket on IE10 giving a SecurityError

查看:2876
本文介绍了IE10上的WebSocket给出了一个SecurityError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用JavaScript中的WebSockets在IE10(Windows 8)下开发一个网站。它在Firefox 18和Chrome 25下运行良好,但在IE10上,当我建立连接时,我得到一个SecurityError。

I am currently developing a website under IE10 (on Windows 8), using WebSockets in JavaScript. It runs fine under Firefox 18 and Chrome 25, but on IE10 I get a SecurityError when I establish the connection.

我正在做的事情看起来很简单:

What I am doing seems pretty straghtforward :

websocket = new WebSocket('wss://hello.dev.mydomain.net');

但IE不喜欢它:

SCRIPT5022: SecurityError 

脚本位于 https://test.dev.mydomain.net (显然不是真正的地址)。

The script is on "https://test.dev.mydomain.net" (not the real address obviously).

让我感到困扰的是,如果我只是双击我本地计算机上的文件(例如file:// ...)它就可以了。更糟糕的是:如果我使用 fiddler 来监控HTTP流量...... 也可以。然而,如果没有fiddler似乎没有任何联系,详见API的规范。 (见下文。)

What bothers me is that if I just double-click the file on my local computer (e.g. file://...) it just works. Even worse: if I use fiddler to monitor HTTP traffic... it also works. Whereas there seems to be no connection at all without fiddler, as detailed in the API's specs. (See below.)

判断为 websocket spec ,该例外也应出现在Chrome / Firefox上......但事实并非如此。所以我怀疑它有什么与HTTP / HTTPS有关。在任何情况下,我在httpS页面上使用wsS套接字...此外:当我用在线示例中找到的另一个有效服务器替换wss地址时,它可以工作。

Judging by websocket spec, the exception should also appear on Chrome/Firefox... but it does not. So I doubt it has anything related to HTTP/HTTPS. In any case, I am using a wsS socket on a httpS page... Moreover: when I replace the wss address by another valid server found on an online example, it works.

我不知道这是否相关,但test.dev.mydomain.net的IP是10.14.xx,其中hello.dev.mydomain.net是194.247.xx我不知道它是否只能在IE上触发某种安全性......

I don't know if this is relevant, but the IP from test.dev.mydomain.net is 10.14.x.x where hello.dev.mydomain.net is 194.247.x.x. I don't know if it could trigger some kind of security on IE only...

还有一件事:我有* .dev.mydomain.net的证书,IE似乎没有问题。该脚本最初驻留在名为my.name.dev.mydomain.net的服务器上,但由于我从另一个URL访问它(因为我们首先认为它可能是某种同源策略问题,所以我得到了重定向),不明白它是如何重要的。至少我希望它没有......

One more thing: I have a certificate for *.dev.mydomain.net, IE does not seems to have problems with it. The script originally resides on a server called my.name.dev.mydomain.net, but since I am accessing it from another URL (I got a redirect since we first thought it could have been some kind of Same Origin Policy issue), I don't see how it could matter. At least I hope it does not...

欢迎任何想法。

编辑:添加网站到受信任的区域也不起作用。

adding the sites to the trusted zone does not work either.

推荐答案

好吧,我的问题不是那么成功,所以我会发布我找到了解决方法。

Well, my question wasn't that successful, so I'll post the "workaround" I found.

我在194.247获得了该网站的另一个地址。。神奇地解决了这个问题。猜猜IE不喜欢混合本地和外部的东西并监视IP。

I got another address for the website, in 194.247.. too. This, magically, solved it. Guess IE doesn't like mixing local and external stuff and watches the IP.

无论如何,我希望这对任何有同样问题的人都会派上用场。

Anyways, I hope this may come in handy to anyone who's got the same issue.

如果您有通过配置IE来解决真实问题的解决方案,请告诉我:)

If you have a solution to solve the "real" issue by configuring IE, let me know :)

干杯,

这篇关于IE10上的WebSocket给出了一个SecurityError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆