如何通过默认的Web浏览器设置IE9? [英] How to set IE9 by default for web browser?

查看:146
本文介绍了如何通过默认的Web浏览器设置IE9?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发C#.NET的应用程序。我想用IE9版本的web浏览器;任一IE9安装在系统或不

I am developing an application in C#.NET. I want to use the IE9 version for WebBrowser; either IE9 is installed on system or not.

是否有可能使用IE9与WebBrower,这可能是因为IE9不安装在我的系统?

Is it possible that using IE9 with WebBrower and it may be that IE9 is not installed in my system?

推荐答案

随着Windows Internet Explorer 8或更高版本的FEATURE_BROWSER_EMULATION功能定义Internet Explorer的默认仿真模式。值9999 - 力量的网页将显示在IE9标准模式,无论DOCTYPE指令!你需要IE9或更高版本在目标系统上安装。检查上网功能控制(B..C)

With Windows Internet Explorer 8 or later the FEATURE_BROWSER_EMULATION feature defines the default emulation mode for Internet Explorer. Value 9999 - forces webpages to be displayed in IE9 Standards mode, regardless of the !DOCTYPE directive. You need IE9 or later installed on the target system. Check Internet Feature Controls (B..C)

private static void WebBrowserVersionEmulation()
{
    const string BROWSER_EMULATION_KEY = 
    @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION";
    //
    // app.exe and app.vshost.exe
    String appname = Process.GetCurrentProcess().ProcessName + ".exe";
    //
    // Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.
    const int browserEmulationMode = 9999;

    RegistryKey browserEmulationKey =
        Registry.CurrentUser.OpenSubKey(BROWSER_EMULATION_KEY,RegistryKeyPermissionCheck.ReadWriteSubTree) ??
        Registry.CurrentUser.CreateSubKey(BROWSER_EMULATION_KEY);

    if (browserEmulationKey != null)
    {
        browserEmulationKey.SetValue(appname, browserEmulationMode, RegistryValueKind.DWord);
        browserEmulationKey.Close();
    }
}

这篇关于如何通过默认的Web浏览器设置IE9?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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