Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How can I set my web browser version emulator when my app is running
I use this code
private static void WebBrowserVersionEmulation(int browserEmulationMode)
       {
           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();
           }
       }


It works onyl If I restart myApplication.
I don't want to restart my App.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900