Use latest version of Internet Explorer in the webbrowser control

后端 未结 13 1394
长发绾君心
长发绾君心 2020-11-21 23:29

The default version of the webbrowser control in a C# Windows Forms application is 7. I have changed to 9 by the article Browser Emulation, but how is it possible t

13条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 00:27

    var appName = System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe";
    
    using (var Key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true))
        Key.SetValue(appName, 99999, RegistryValueKind.DWord);
    

    According to what I read here (Controlling WebBrowser Control Compatibility:

    What Happens if I Set the FEATURE_BROWSER_EMULATION Document Mode Value Higher than the IE Version on the Client?

    Obviously, the browser control can only support a document mode that is less than or equal to the IE version installed on the client. Using the FEATURE_BROWSER_EMULATION key works best for enterprise line of business apps where there is a deployed and support version of the browser. In the case you set the value to a browser mode that is a higher version than the browser version installed on the client, the browser control will choose the highest document mode available.

    The simplest thing is to put a very high decimal number ...

提交回复
热议问题