zoukankan      html  css  js  c++  java
  • 通过注册表修改IE浏览器内核版本

    static public void SetIERegistry()
    {
      try
      {
       //获取系统IE版本号
       string strIEVersion = SysIeVersion();
       if (string.IsNullOrEmpty(strIEVersion) || strIEVersion.Split('.').Length < 1)
       return;

       //注册表版本号
       int strValue = int.Parse(strIEVersion.Split('.').GetValue(0).ToString()) * 1000;

       //不一样 修改注册表
       RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWAREWow6432NodeMicrosoftInternet ExplorerMAINFeatureControlFEATURE_BROWSER_EMULATION", true);//打开注册表子项
       if (key == null)
       key = Registry.LocalMachine.CreateSubKey(@"SOFTWAREWow6432NodeMicrosoftInternet ExplorerMAINFeatureControlFEATURE_BROWSER_EMULATION");

       string strAppName = Path.GetFileName(Application.ExecutablePath);

       if (key.GetValue(strAppName) == null || key.GetValue(strAppName).ToString() != strValue.ToString())
       {
          key.SetValue(strAppName, strValue, RegistryValueKind.DWord);
       }
       key.Close();
     }
     catch (Exception ex)
     {
       Console.WriteLine(ex.Message);
     }
    }

    //获取系统IE版本号
    static public string SysIeVersion()
    {
      RegistryKey versionKey = Registry.LocalMachine.OpenSubKey(@"SoftwareMicrosoftInternet Explorer");
      try
      {
        return versionKey.GetValue("Version").ToString();
      }
      finally
      {
        versionKey.Close();
      }
    }

    ----------------------------------------------------------------------------
    创建于2017年6月29日

    整理于2017年11月30日

  • 相关阅读:
    Codeforces 235C Cyclical Quest 后缀自动机
    HDU-6583 Typewriter 后缀自动机+dp
    HDU-4436 str2int 后缀自动机
    [题解]诸侯安置(dp+组合)
    [题解]洛谷P1350车的放置
    二进制表示中1的个数与异或关系
    [洛谷P1593][POJ-1845Sumdiv] 因子和
    [USACO08DEC]拍头Patting Heads 题解
    [小白逛公园]|[SP1716]|[UVA1400]解题报告(三合一)
    P2034选择数字题解
  • 原文地址:https://www.cnblogs.com/kanjinxiang/p/7929560.html
Copyright © 2011-2022 走看看