脚本运行在DOTNET WebBrowser控件慢 [英] Script runs slower in the dotnet WebBrowser control

查看:240
本文介绍了脚本运行在DOTNET WebBrowser控件慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用WebBrowser控件和平滑滚动股利我的WinForms应用程序来渲染HTML选取框的。我下载了样品,并添加

I use the WebBrowser control and Smooth Div Scroll in my winforms application to render a html marquee. I downloaded the sample and added

autoScrollingInterval: 3

$("div#makeMeScrollable").smoothDivScroll({
    autoScrollingMode: "onStart"
});



,使其移动速度更快。当我打开IE浏览器只是正常的样品,但是当我使用WebBrowser控件,并调用导航方法的滚动条动作要慢得多。

to make it move faster. When I open the sample in IE it works just fine but when I use the WebBrowser control and call the navigate method the scroller moves much slower.

是什么导致这个问题?

What is causing this problem?

推荐答案

据我了解,你正在处理的问题是一个版本的问题与WebBrowser控件在IE 7标准模式呈现并且您使用IE中的实际web浏览器或者是IE 8或IE 9,和它的作品在那里,但你的JQuery / JavaScript或CSS夹杂物没有在IE 7的工作。

As I understand it, the issue you are dealing with is a versioning issue with the WebBrowser Control rendering in IE 7 Standard Mode and the actual WebBrowser you are using in IE is either IE 8 or IE 9, and it works there, yet your JQuery/JavaScript or CSS inclusions are not working in IE 7.

让我告诉你直线上升。默认的
WebBrowser控件渲染引擎固定为确保所有
平台之间的兼容性。

Let me tell you this straight up. The default rendering engine on the webbrowser control is fixed to ensure compatibility across all platforms.

基本上,如果你安装的浏览器是IE 7 - IE 9,用那么
渲染引擎是IE 7.0只(默认)

Basically, if you're installed browser is IE 7 - IE 9, then the rendering engine used is IE 7.0 only (by default).

不过,如果你安装了IE版本是IE 6或。下面,用那么
渲染引擎是IE 4.0(不是开玩笑),当然,除非你
设置它,否则。

If, however, your installed IE version is IE 6 or below, then the rendering engine used is IE 4.0 (not kidding), unless of course you set it otherwise.

有一种误解该WebBrowser控件使用任何当前安装
(当前的IE版本),但事实却并非如此,因为
他们这样做是为了减少向后兼容性问题。你可以看到
(如证明),这真的是你的问题,通过将
www.whatsmyuseragent.com在您的正常浏览器,然后在你的web浏览器控件再次将
该网站,你会看到它
说MSIE 7.0:)

There is a misconception that WebBrowser control uses whatever is currently installed (current IE version) but this is not true, since they do this to reduce backward compatibility issues. You can see (as proof) that this really is your problem by going to www.whatsmyuseragent.com in your normal browser, and then going to that website again in your WebBrowser control, you will see that it says MSIE 7.0 :).

您可以将其设置为使用互联网
Explorer的当前安装的版本,或者使用。 META标记的页,或编辑所在的机器WebBrowser控件将运行注册表
(编辑为
CURRENT_USER和LOCAL_MACHINE将两者的工作)。

You can set it to use the current installed version of internet explorer, either using a META tag in-page, or editing the Registry on the machine where the webbrowser control will run (editing for Current_User and Local_Machine will both work).

WebBrowser控件会(通常)使用你
已经安装任何版本的IE,但由于兼容性的原因将默认页面呈现在IE7标准模式

WebBrowser control will (normally) use whatever version of IE you have installed, but for compatibility reasons it will render pages in IE7 Standards mode by default.

如果你想利用新的IE9功能,您应该添加
meta标签< META HTTP-EQUIV = X-UA-Compatible的内容=IE = 9>
中的< HEAD> HTML页面的标签。

If you want to take advantage of new IE9 features, you should add the meta tag <meta http-equiv="X-UA-Compatible" content="IE=9" > inside the <head> tag of your HTML page.

这meta标签必须在任何链接,CSS添加,JavaScript的
文件等,同时也是在< HEAD> 正常工作,但(仅
<元> 标记或<标题> 标记前,可以在来)。

This meta tag must be added before any links to CSS, JavaScript files etc that are also in your <head> to work properly though (only other <meta> tags or the <title> tag can come before it).

另一种方法是一个注册表项添加到:

An alternative is to add a registry entry to:

HKLM> SOFTWARE >微软> Internet Explorer中>首页>
FeatureControl> FEATURE_BROWSER_EMULATION

HKLM > SOFTWARE > Microsoft > Internet Explorer > Main > FeatureControl > FEATURE_BROWSER_EMULATION

和在那里添加YourCompiledApplicationName.exe,值为 9000'到
强制WebBrowser控件来显示IE9模式页面。虽然
有可以使用太过其他值,注意,这些文档
并不像它似乎并不可能得到一个页面
在IE来呈现8模式的任何值完全准确你用。 (注:YourCompiledApplicationName.exe必须是您编译包含您的WebBrowser控件的EXE文件名,它只会为你已经包含在注册表中的文件名工作)。此外,使它在一项通过你的IDE运行Works,而且,如果你的应用程序是64位Windows下运行它难道不伤害添加vshost.exe和YourCompiledApplicationName.exe.svchost,你可能还应该设置下面的注册表路径下的以下DWORD为相同的值(根据32位路径):

And in there add 'YourCompiledApplicationName.exe' with value '9000' to force the WebBrowser control to display pages in IE9 mode. Though there are other values you can use too too, note that these docs aren't entirely accurate as it does not seem possible to get a page to render in IE 8 mode whatever value you use. (Note: YourCompiledApplicationName.exe must be the EXE file name that you compile which contains your WebBrowser Control, it will only work for the file name that you've included in the registry). Also, it wouldnt hurt to add vshost.exe and YourCompiledApplicationName.exe.svchost so it works when run through your IDE, and also, If your app is running under 64bit Windows, you likely should also set the following DWORD under the following registry path to the same value (as per the 32bit path):

HK [LM | CU] \ SOFTWARE \ Wow6432Node \微软\\ \\的Internet Explorer \ \的主要
FeatureControl \ FEATURE_BROWSER_EMULATION

HK[LM|CU] \ SOFTWARE \ Wow6432Node \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BROWSER_EMULATION

添加注册表项以在HKCU相同的路径,而不是HKLM
也将工作 - 这是非常有用的书面HKLM需要管理员
特权,其中作为HKCU没有。

Adding the registry key to the same path in HKCU instead of HKLM will also work - this is useful as writing to HKLM requires admin privileges where as HKCU does not.

不知道,当IE浏览器10.0出来,如果​​在WebBrowser控件
默认引擎会去10.0(如果安装在
套餐的系统10.0 ),或者如果它仍将作为IE 7.0后,即使IE 10.0释放
,我们将不得不看到,一旦它出来。但是,如果我们根据以往的经验
猜,我怀疑IE 10.0将是
最后一个版本,它使用IE 7.0渲染引擎,当IE 11自带
OUT,默认渲染引擎继续作为IE 11 IE 11安培之间的IE浏览器的所有
版本; IE 14,这只是一个猜测由
推断他们在过去所做的那样。

Not sure if when IE 10.0 comes out if the WebBrowser controls default engine will go to 10.0 (if 10.0 is installed on system of course) or if it will remain as IE 7.0 even after IE 10.0 is released, we will have to see once it comes out. However, if we guess based on previous experience, i suspect IE 10.0 will be the last version that uses IE 7.0 rendering engine, and when IE 11 comes out, the default rendering engine will remain as IE 11 for all versions of IE between IE 11 & IE 14. This is just a guess by extrapolating what they've done in the past.

有关值的更多信息,可以将注册表设置,检查了这一点:

For more information on the values you can set the registry to,check this out:

这篇关于脚本运行在DOTNET WebBrowser控件慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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