- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用自动化(即 COM 自动化)在 Internet Explorer 中显示一些 HTML (9):
ie = CoInternetExplorer.Create;
ie.Navigate2("about:blank");
webDocument = ie.Document;
webDocument.Write(szSourceHTML);
webDocument.Close();
ie.Visible = True;
出现 Internet Explorer,显示我的 html,其开头为:
<!DOCTYPE html>
<HTML>
<HEAD>
...
Note: the html5 standards-mode opt-in doctype
html
除非该文档不是ie9标准模式;它处于 ie8 标准模式:
<小时/>如果我先将 html 保存到我的计算机上:
然后查看那个html文档,IE就进入标准模式了:
我的问题是如何更新我的 SpawnIEWithSource(String html)
函数以使浏览器进入标准模式?
void SpawnIEWithSource(String html)
{
Variant ie = CoInternetExplorer.Create();
ie.Navigate2("about:blank");
webDocument = ie.Document;
webDocument.Write(html);
webDocument.Close();
ie.Visible = true;
}
<小时/>
编辑:更冗长、更难以理解或可读的代码示例,这无助于进一步解决问题可能是:
IWebBrowser2 ie;
CoCreateInstance(CLASS_InternetExplorer, null, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_WebBrowser2, ie);
ie.AddRef();
ie.Navigate2("about:blank");
IHtmlDocument doc;
dispDoc = ie.Document;
dispDoc.AddRef();
dispDoc.QueryInterface(IHTMLDocument2, doc);
dispDoc.Release()
doc.Write(html);
doc.Close();
doc.Release();
ie.Visible = true;
ie.Release();
<小时/>
评论者在 ieblog 条目上提问 Testing sites with Browser Mode vs. Doc Mode :
Can we get a description of how the document mode is determined when the HTML content is within an embedded webcontrol? Seems to be that the document mode is choosen differently - maybe for compatibility reasons?
MarkSil [MSFT] 回复:
@Thomas: Thanks for raising that question. The WebBrowser Control determines the doc mode the same way that IE does because it contains the same web platform (e.g. there is one shared mshtml.dll across IE and WebBrowser Control hosts). The WebBrowser Control does default to the Compatibility View browser mode, which means that the default doc mode is IE7. Here is a blog post with more detail on this: blogs.msdn.com/.../more-ie8-extensibility-improvements.aspx.
托马斯对此回应:
@MarcSil (re: WebBrowser Control)
The problem with using registry entries to select document mode for WebControl is that it applies to the application as a whole. I write plugins for Google SketchUp where you have WebDialog windows to create UIs - it's just a WebBrowser control in a window. But that leads to problems as I want to force a document mode for my instance of the WebBrowser control, not for all of SU's WebBrowser controls as a whole.
So, my question is: how do you control the document mode per instance for a WebBrowser control?
最佳答案
您是否尝试过在 html 中设置
<meta http-equiv="X-UA-Compatible" content="IE=9" />
或
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
这意味着最新版本
关于com - 如何把IE9的WebBrowser控件纳入标准?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31962511/
我正在开发 Kext,它应该可以访问 struct proc->p_pid field 。问题是该结构仅在 XNU 源中定义,所以我面临 incomplete definition of type '
下面是 ES2015 类中的一个方法。 它不能是箭头函数,因为它是异步函数。 但由于它不是箭头函数,因此“this”不在范围内,因此我无法执行 setstate 之类的操作。 有人可以建议我如何将其纳
我想使用 Bootstrap 创建 NC 主题。 我通过 Visual Studio 2013 中的 Nugets 包管理器安装了 Bootstrap。然后我添加: Html.AppendScript
我是一名优秀的程序员,十分优秀!