zoukankan      html  css  js  c++  java
  • winform webbrowser如何强制使用ie11内核?

    webkit.net ,cefsharp,openwebkit.net等这些基于谷歌或者基于firfox内核的浏览器有个共同点,就是必须指定winform为x86的才能使用,

    而且使用过程中也是各种坑需要去填。

    webbrowser不好的地方是默认使用ie5内核来加载网页,不得不吐槽下微软真是奇葩,ie已经退出了历史舞台,但是winform里面的webbrowser控件使用的还是ie内核,

    项目有个需求是,winform程序,必须是x64的,x86经常内存溢出,于是,那些基于谷歌内核的都被pass掉了。

    winform里面嵌套的网站之前都是基于谷歌内核来开发的,在ie11里面虽然还有一些小瑕疵,但是毕竟可以使用,

    于是考虑如何让winform x64调用IE11的内核。

    代码如下:

    RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWAREMicrosoftInternet ExplorerMAINFeatureControlFEATURE_BROWSER_EMULATION", true);
    if (key != null)
    {
    key.SetValue("XXX.exe", 11001, RegistryValueKind.DWord);
    key.SetValue("XXX.vshost.exe", 11001, RegistryValueKind.DWord);//调试运行需要加上,否则不起作用
    }

    key = Registry.LocalMachine.OpenSubKey(@"SOFTWAREWow6432NodeMicrosoftInternet ExplorerMAINFeatureControlFEATURE_BROWSER_EMULATION", true);
    if (key != null)
    {
    key.SetValue("XXX.exe", 11001, RegistryValueKind.DWord);
    key.SetValue("XXX.vshost.exe", 11001, RegistryValueKind.DWord);//调试运行需要加上,否则不起作用
    }

    IE各版本的值如下:

    • 11001 (0x2EDF) Internet Explorer 11. Webpages are displayed in IE11 Standards mode, regardless of the !DOCTYPE directive

    • 11000 (0x2AF8) :Internet Explorer 11. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode

    • 10000 (0x2710) :Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.

    • 10001 (0x2AF7) :Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.

    • 9999 (0x270F) :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.

    • 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.

    • 7000 (0x1B58) :Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode.

  • 相关阅读:
    2020总结来了,文末有福利
    CentOS 用户请关注,你期待的 CentOS Linux 9 再也不会来了
    全球最好的10款波尔多葡萄酒,拉菲居然垫底
    eth以太坊合约开发工具集
    html格式的文字去掉html tag转为纯text文字
    如何隐藏X-Powered-By
    aiXcoder3.0呼之欲出,代码补全 AI,带你进入「个性化智能编程时代」
    windows故障群集修改心跳网卡【原创】
    keepalived非争抢机制不生效报错Received lower prio advert, forcing new election
    MySQL主从复制,启动slave时报错1872 Slave failed to initialize relay log info structure from the repository
  • 原文地址:https://www.cnblogs.com/y114113/p/7458043.html
Copyright © 2011-2022 走看看