По умолчанию WebBrowser в C# рендерит страницу по правилам IE7. Для изменения данного поведения нужно поправить ключ FEATURE_BROWSER_EMULATION\APPNAME (где APPNAME - имя приложения) в реестре:
try
{
RegistryKey RegistryKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION");
RegistryKey.SetValue(System.AppDomain.CurrentDomain.FriendlyName, 11001, RegistryValueKind.DWord);
}
catch (Exception Ex)
{
Console.WriteLine("Registry update error: " + Ex.Message);
Console.WriteLine("Can't change browser version.");
}
Табличка со значениями из MSDN:
Значение | Описание (поведение браузера) |
11001 (0x2AF9) | Internet Explorer 11. Webpages are displayed in IE11 edge mode, regardless of the !DOCTYPE directive. |
11000 (0x2AF8) | IE11. Webpages containing standards-based !DOCTYPE directives are displayed in IE11 edge mode. Default value for IE11. |
10001 (0x2711) | Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive. |
10000 (0x02710) | Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10. |
9999 (0x270F) | Windows Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive. |
9000 (0x2328) |
Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9. Important In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. |
8888 (0x22B8) | Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive. |
8000 (0x1F40) |
Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode. Default value for Internet Explorer 8 Important In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. |
7000 (0x1B58) | Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode. Default value for applications hosting the WebBrowser Control. |