[英]Windows.Forms.WebBrowser Control not using correct Document Mode
I have a WebBrowser control in a standard windows forms application. 我在标准Windows窗体应用程序中有一个WebBrowser控件。
The machine it is running on has IE11 installed. 运行它的计算机已安装IE11。
Where wbr is an instance of the WebBrowser control, wbr.Version.Major returns 11 meaning it is using IE11. 其中wbr是WebBrowser控件的实例,wbr.Version.Major返回11,表示它正在使用IE11。
When pointed at a web page with the following at the top of the document: 当指向文档顶部带有以下内容的网页时:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
Calling document.documentMode in the Javascript returns '8'. 在Javascript中调用document.documentMode返回'8'。
This means the page is rendering in the IE8 document mode (and is reflected in the output, CSS3 properties are not rendered properly). 这意味着该页面以IE8文档模式呈现(并反映在输出中,CSS3属性未正确呈现)。
I also set the browser emulation mode in the registry to both 11001 and 11000 for the application with no apparent effect. 我还为应用程序将注册表中的浏览器仿真模式设置为11001和11000,都没有明显的效果。 (See http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation )
(请参阅http://msdn.microsoft.com/zh-cn/library/ee330730%28v=vs.85%29.aspx#browser_emulation )
Can someone shed some light as to why the IE11 WebBrowser control is setting the document mode to 8 despite having both the doctype and the meta tag defined? 有人可以说明为什么尽管同时定义了doctype和meta标签,但IE11 WebBrowser控件为何将文档模式设置为8吗?
Thanks 谢谢
While I'm not sure why having the doctype and meta tag set still prevents the WebBrowser control running in IE11 mode, the reason why the registry hack didn't work is due to the difference in 32-bit and 64-bit registries. 虽然我不确定为什么设置doctype和meta标签仍然会阻止WebBrowser控件在IE11模式下运行,但是注册表黑客无法正常工作的原因是32位和64位注册表的不同。
If you are editing the registry for a 32-bit application, the registry entries for those applications will be found in an additional directory abstraction called Wow6432Node. 如果要编辑32位应用程序的注册表,则可以在名为Wow6432Node的附加目录抽象中找到这些应用程序的注册表项。
This is where the registry change should be made. 这是应该更改注册表的地方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.