简体   繁体   English

Windows.Forms.WebBrowser控件未使用正确的文档模式

[英]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.

相关问题 Windows.Forms.WebBrowser和重定向? - Windows.Forms.WebBrowser and redirects? 如何在使用Windows.Forms.WebBrowser控件浏览Web文档的同时释放内存 - How to release memory whilst navigating web documents using a Windows.Forms.WebBrowser control C#Windows.Forms.WebBrowser缩放 - C# Windows.Forms.WebBrowser scaling Windows.Forms.WebBrowser加载页面以及本地SVG文件 - Windows.Forms.WebBrowser loading page with local SVG file 在Windows窗体中使用C#在编辑模式下使用MSHTML WebBrowser时,如何检测文档更改? - How to detect document changes when using the MSHTML WebBrowser in edit mode using C# in Windows Forms? IE的getBoundingClientRect在浏览器中给出的答案与在Windows.forms.webbrowser中给出的答案不同-为什么? - IE's getBoundingClientRect gives different answer in browser than in windows.forms.webbrowser - why? 使用jQuery异步获取.NET Windows Forms WebBrowser控件的文档的DIV元素的文本值 - Using jQuery to asynchronously get text value of a DIV element of a .NET Windows Forms WebBrowser control's document Windows窗体WebBrowser控件:DocumentText与Document.Body.OuterHtml - Windows Forms WebBrowser control: DocumentText vs Document.Body.OuterHtml Windows窗体WebBrowser控件和iframe - Windows Forms WebBrowser control and iframes Windows窗体WebBrowser控件和AJAX - Windows Forms WebBrowser Control and AJAX
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM