在winforms应用程序中托管的MSIEs WebBrowser控件以兼容模式运行 [英] MSIEs WebBrowser control hosted in winforms app runs in compatibility mode

本文介绍了在winforms应用程序中托管的MSIEs WebBrowser控件以兼容模式运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以winforms形式主持MSIE。不幸的是,它坚持在兼容模式下运行,无论我是否在独立IE中给它一个在IE8模式下运行的页面。这样做的结果是,在独立的MSIE中正确呈现的某些内容在托管控件中完全不对齐并搞砸了。

I'm hosting MSIE in a winforms form. Unfortunately it insists on running in compatibility mode regardless of if I give it a page that runs in IE8 mode in stand-alone IE. The effect of that is that some content that renders correctly in stand-alone MSIE gets completely mis-aligned and messed up in the hosted control.

除文档类型等外,是有一些神奇的方法告诉webbrowser我希望它以与在独立的MSIE中加载它相同的方式呈现页面吗?

Besides document type etc, is there some magic way to tell the webbrowser that I want it to render the page the same way as if I loaded it in stand-alone MSIE?

我不想要使用注册表项覆盖( http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx )由于我的表单是另一个应用程序的加载项的一部分。我不想更改主应用程序的IE行为,我不想为在该应用程序下运行的其他加载项更改它。我只希望这个在我的表单中托管的浏览器中工作,而不是在应用程序范围内而不是在整个流程范围内。

I don't want to use the registry key override ( http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx ) due to my form being part of an add-in for another app. I don't want to change the IE behavior for the main app and I don't want to change it for other add-ins running under that app. I only want this to work within the browser hosted in my form, not app-wide and not process-wide.

推荐答案

我没有测试过这个,但是如何使用 META 标签,以及 HTTP-EQUIV 属性,将 X-UA-COMPATIBLE 值设置为 IE = 8 ,指示Web浏览器以IE 8标准模式显示页面。一个例子是:

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.


默认情况下,托管
WebBrowser控件的应用程序在IE7模式
中打开
基于标准的页面,除非该页面包含
相应的X-UA-Compatible标头。
您可以通过将应用程序可执行文件的名称
添加到
FEATURE_BROWSER_EMULATION功能
控制键并相应地设置值
来更改此值。

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.

这篇关于在winforms应用程序中托管的MSIEs WebBrowser控件以兼容模式运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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