MSIEs WebBrowser control hosted in winforms app runs in compatibility mode

浪尽此生 提交于 2019-12-03 06:25:40

I have not tested this, but how about using the META tag, along with the HTTP-EQUIV attribute, to set the X-UA-COMPATIBLE value to IE=8, which instructs the web browser to display a page in IE 8 standards mode. An example would be:

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

From this line in the following article it seems that this should work.

By default, applications hosting the WebBrowser Control open standards-based pages in IE7 mode unless the page contains an appropriate X-UA-Compatible header. You can change this by adding the name of the application executable file to the FEATURE_BROWSER_EMULATION feature control key and setting the value accordingly.

To change the default behavior of the Web Browser Control running in your application to match what IE itself does, you must set the FEATURE_BROWSER_EMULATION Feature Control Key.

For instance, you can mimic IE8's behavior (allowing sites to render in IE8 standards mode) as follows.

Inside HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl

Create a new key named FEATURE_BROWSER_EMULATION

Inside that key, add a new REG_DWORD with value 8000 with the name of your application's executable. E.g.:

"YourApp.exe" = dword 8000 (Hex: 0x1F40)

Further details are at: http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!