我正在使用自动化(即COM自动化)在Internet Explorer(9)中显示一些HTML:
ie = CoInternetExplorer.Create;
ie.Navigate2("about:blank");
webDocument = ie.Document;
webDocument.Write(szSourceHTML);
webDocument.Close();
ie.Visible = True;
Run Code Online (Sandbox Code Playgroud)
出现Internet Explorer,显示我的html,其开头为:
<!DOCTYPE html>
<HTML>
<HEAD>
...
Run Code Online (Sandbox Code Playgroud)
注意: html5标准模式选择加入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;
}
Run Code Online (Sandbox Code Playgroud)
编辑:一个更详细,更不易理解或可读的代码示例,这无助于进一步提出问题可能是:
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(); …Run Code Online (Sandbox Code Playgroud) 由于TWebbrowser在IE7兼容模式下运行,我遇到了TWebbrowser的Javascript错误.
有没有办法防止这种情况,只是让它在IE9模式下运行?
我们知道Internet Explorer将在Windows 10中停止使用,由新的Microsoft Edge(以前代号为"Project Spartan")取代.
有数百万的应用程序使用TWebbrowser,这是一个使用Internet Explorer API的组件.
有没有人知道这些应用程序在未来的Windows版本中如何工作?我们如何准备好让我们的应用程序在未来的Windows版本中运行?
我在http://www.delphiflash.com/demo-youtube-video上看到如何在delphi上加载flash视频,但它不是免费的.还有其他方法吗?
喜欢HTML然后TWebBroeser?
sampleVideo.html //这对TwebBrowser不起作用还有其他方法吗?
<html>
<head>
</style>
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
</head>
<body>
<object width="640" height="390">
<param name="movie" value="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3">
</param><param name="allowFullScreen" value="true">
</param><param name="allowScriptAccess" value="always">
</param><embed src="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390">
</embed></object>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) delphi ×2
twebbrowser ×2
activex ×1
automation ×1
com ×1
flash ×1
html5 ×1
standards ×1
video ×1
windows-10 ×1
youtube ×1