我尝试使用以下代码调用javascript函数
Webbrowser.Document.InvokeScript("something")
它在IE8中工作,但在IE9中不起作用。 有人对我有什么建议吗?
答案 0 :(得分:0)
尝试像这样进行模拟
static private void UseIE9DocMode()
{
RegistryKey key = null;
try
{
key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
}
catch (Exception)
{
key = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION");
}
key.SetValue(System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName, 9999, RegistryValueKind.DWord);
key.Close();
}
看到那些网址: http://deletethis.net/dave/?page=2&q=document http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx
答案 1 :(得分:0)
我通过将以下代码添加到HEAD
IE 9
标记解决了我的问题
<meta http-equiv="X-UA-Compatible" content="IE=9">