我不能使用的WebSocket内.NET(vb.net)WebBrowser控件我不、控件、WebSocket、vb

2023-09-03 01:16:28 作者:流氓大叔@

我想运行一个WebBrowser控件至极内的网页包含到的WebSocket的连接。控制无法连接到WebSocket的。 当我在IE浏览器进行测试,一切运行正常,但在Visual Studio内部的WebBrowser控件,网页无法连接到WebSocket的。 我想,它包含的脚本来检测的WebSockets浏览器支持的其他页面,当它运行在IE浏览器,页面显示的WebSocket运行成功了,但是当我尝试运行Web浏览器控件在同一个页面,该页面表示,三夏可以'T运行。我该怎么做才能解决这个问题? 非常感谢你。

I'm trying to run an webpage inside a Webbrowser control wich contains a connection to an Websocket. The control can't connect to the Websocket. When I tested in IE, everything runs ok, but in the Webbrowser control inside Visual Studio, the page can't connect to the Websocket. I tried other pages that contains script to detect browser support for Websockets, when it runs in IE, the page show that Websocket runs with success, but when I'm try to run the same page on Webbrowser control, the page says that webcontrol can't run. How can I do to solve this problem? Very thank you.

推荐答案

问题是,WebBrowser控件,而使用本地IE浏览器为基础,更多的是锁定的(或者不如说不同的配置)由默认值。

The problem is that the webbrowser control, while using the local IE as a basis, is more locked down (or maybe better to say "differently configured") by default.

要控制这种能力被称为功能控制,你可以读到关于它的 MSDN这里

The ability to control this is called Feature Control and you can read about it on MSDN here

在解决实际问题方面,类似的问题已经解决,在这个答案提供code对C#的等效问题。注意在随后回答的为好。

In terms of solving your actual problems, a similar question has been solved with code provided in this answer to an equivalent question on C#. Note the tweaks in the subsequent answer as well.