简体   繁体   English

vb.net Webbrowser控件未显示Javascript

[英]vb.net Webbrowser Control not displaying Javascript

I have tried this on numerous pc's and are receiving the same error. 我已经在许多PC上尝试过此操作,并且收到相同的错误。 My webbrowser control isnt displaying javascript or jquery. 我的网络浏览器控件未显示javascript或jquery。

Here is a example: 这是一个例子:

when i visit this url in my browser: https://binarykings.co.uk/traderoom-aspx , it looks great with the charts and prices etc. 当我在浏览器中访问此URL时: https : //binarykings.co.uk/traderoom-aspx ,它与图表和价格等一起看起来不错。

example: http://i.imgur.com/1Lmq4em.png 示例: http//i.imgur.com/1Lmq4em.png

same in internet explorer: http://i.imgur.com/3KP864X.png 在Internet Explorer中也是如此: http : //i.imgur.com/3KP864X.png

however in my vb.net webbrowser control it looks like this: http://i.imgur.com/qjme2Yg.jpg 但是在我的vb.net Webbrowser控件中,它看起来像这样: http : //i.imgur.com/qjme2Yg.jpg

What is causing this ? 是什么原因造成的? Its not just this site but any other site that has a similar way of displaying things via jquery/javascript. 它不仅是这个站点,而且是其他任何具有通过jquery / javascript显示内容的类似方式的站点。

I do have script errors suppressed however when i disabled this and clicked yes to the errors manually it still displayed the same empty page. 我确实抑制了脚本错误,但是当我禁用此错误并手动单击“是”错误时,它仍然显示相同的空白页。

Thanks 谢谢

The WebBrowser control uses the Internet Explorer rendering engine. WebBrowser控件使用Internet Explorer呈现引擎。 But by default, for compatibility reasons, it is stuck using the IE 7 rendering engine, even if you have a later version of the browser installed on your computer. 但是默认情况下,出于兼容性原因,即使您的计算机上安装了更高版本的浏览器,它也会被IE 7渲染引擎卡住。

There are a couple of ways to convince it to use a newer version of IE to render the page. 有两种方法可以说服它使用较新版本的IE呈现页面。 One involves editing the registry, while the other involves modifying the web page. 一种涉及编辑注册表,而另一种涉及修改网页。

In general, it is best to avoid attempts to solve local problems with global solutions like registry edits. 通常,最好避免尝试使用注册表编辑器之类的全局解决方案来解决本地问题。 There might be another app running on the same machine that uses the WebBrowser control and relies on the behavior of the IE 7 rendering engine. 使用WebBrowser控件并依赖 IE 7呈现引擎的行为的同一台计算机上可能运行着另一个应用程序。 If you go changing global settings, you'll mess up that other app. 如果您要更改全局设置,则会弄乱其他应用程序。

Therefore, the best solution, if possible, is to edit the web page. 因此,最好的解决方案是编辑网页。 This is quite simple, and probably a good idea anyway. 这很简单,无论如何可能是一个好主意。 All you need to do is add the following code inside of the <head> section: 您需要做的就是在<head>部分中添加以下代码:

<meta http-equiv="X-UA-Compatible" content="IE=9" >

If you absolutely must use the alternative approach of editing the registry, you'll find the information you need here in the documentation . 如果您绝对必须使用替代方法来编辑注册表,则可以在文档中找到所需的信息。

I am using the firefox webbrowser control instead: 我改用firefox webbrowser控件:

Full instructions here http://www.skillerzforum.com/Thread-VB-net-How-to-make-a-Firefox-Webbrowser 此处的完整说明http://www.skillerzforum.com/Thread-VB-net-How-to-make-a-Firefox-Webbrowser

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM