如何设置WPF webbrowser控件以在iE10模式下呈现页面或在机器上安装更高版本 . 默认情况下,如果我在OS> Windows 7的任何机器上创建.net 4或.net 4.5应用程序,它只会在IE7模式下呈现html页面 . (如果我错了,请更正)如果在目标机器上安装IE10,如何启用应用程序以IE10模式呈现html页面?任何帮助
您可以使用此处所述的注册表:
http://msdn.microsoft.com/en-us/library/ie/ee330730%28v=vs.85%29.aspx
编辑:为了更好的解释你也可以阅读这个答案Will the IE9 WebBrowser Control Support all of IE9's features, including SVG?
如果您不想修改注册表并控制网页,则可以使用
<meta http-equiv="X-UA-Compatible" content="IE=10">
标签在文件的头部 . 我认为必须首先或紧跟在_1035372之后才能工作 .
对于WPF webbrowser控件使用IE11模式需要,例如,在主窗口的构造函数中,添加以下代码:
var pricipal = new System.Security.Principal.WindowsPrincipal( System.Security.Principal.WindowsIdentity.GetCurrent()); if(pricipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) { RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey (@"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true); string myProgramName = Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location); var currentValue = registrybrowser.GetValue(myProgramName); if (currentValue == null || (int)currentValue != 0x00002af9) registrybrowser.SetValue(myProgramName, 0x00002af9, RegistryValueKind.DWord); } else this.Title += " ( Первый раз запускать с правами админа )";
如果你想在Visual Studio中运行时看到WPF webbrowser控件在DEBUG模式下使用IE11模式,你需要在注册表中添加所有progmam“*” . 这可以使用以下代码完成:
var pricipal = new System.Security.Principal.WindowsPrincipal( System.Security.Principal.WindowsIdentity.GetCurrent()); if (pricipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) { RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey (@"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true); var currentValue = registrybrowser.GetValue("*"); if (currentValue == null || (int)currentValue != 0x00002af9) registrybrowser.SetValue("*", 0x00002af9, RegistryValueKind.DWord); } else this.Title += " ( Первый раз запускать с правами админа )";
检查windows 10和visual studio 2015 .
备注:编码其他版本的Internet Explorer,请参阅此处https://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx#browser_emulation
3 回答
您可以使用此处所述的注册表:
http://msdn.microsoft.com/en-us/library/ie/ee330730%28v=vs.85%29.aspx
编辑:为了更好的解释你也可以阅读这个答案Will the IE9 WebBrowser Control Support all of IE9's features, including SVG?
如果您不想修改注册表并控制网页,则可以使用
标签在文件的头部 . 我认为必须首先或紧跟在_1035372之后才能工作 .
对于WPF webbrowser控件使用IE11模式需要,例如,在主窗口的构造函数中,添加以下代码:
如果你想在Visual Studio中运行时看到WPF webbrowser控件在DEBUG模式下使用IE11模式,你需要在注册表中添加所有progmam“*” . 这可以使用以下代码完成:
检查windows 10和visual studio 2015 .
备注:编码其他版本的Internet Explorer,请参阅此处https://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx#browser_emulation