zoukankan      html  css  js  c++  java
  • WebBrowser控件默认使用IE9,IE10的方法

    最近为了抓取淘宝的成交数据,用C#的WebBrowser控件开发了一个简单的程序.
    发现WebBrowser控件默认使用的版本是IE7的兼容模式.而淘宝的宝贝详细页居然对IE7的支持不是很好.
    成交记录无法显示,而我本机安装的是IE10,那么有没有办法使我的WebBrowser控件的使用的IE版本高点呢?
    查找到了MSDN的一篇文章,上面有详细的说明,简单翻译如下:
    1,打开注册表
    HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
        SOFTWARE
           Microsoft
              Internet Explorer
                 Main
                    FeatureControl
                       FEATURE_BROWSER_EMULATION
                          contoso.exe = (DWORD) 00000000
    其中的"contoso.exe"为您的程序名字.即嵌入了WebBrowser控件的可执行程序的名字.
    后面的数值"00000000"代表WebBrowser控件使用的IE的版本,值对应的IE版本如下图:
    ie-emulation
    如果您使用的是64位的操作系统,而你的程序是32位的,那么你则要在以下注册表中更改该值.
    HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
        SOFTWARE
            Wow6432Note
                Microsoft
                    Internet Explorer
                        Main
                            FeatureControl
                                FEATURE_BROWSER_EMULATION
    
                                    contoso.exe = (DWORD) 00000000
    
    

    360浏览器,傲游浏览器,淘宝浏览器等都可以用这种方式来操作.

     

    注意: 我使用VS2010编译的时候,如果是Debug模式,那么我在注册表中更改的内容无效;如果使用了Release模式,则注册表的内容立即生效!

    2017-07-19补充IE11的使用方法

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




  • 相关阅读:
    doraemon的python 函数(整理了下笔记)感觉自己棒棒哒
    Mybatis系列教材 (七)- 动态SQL
    Mybatis系列教材 (六)- 基础
    Mybatis系列教材 (五)- 基础
    Mybatis系列教材 (四)- 基础
    Mybatis系列教材 (三)- 基础
    Mybatis系列教材 (二)- 基础
    Mybatis系列教材 (一)- 入门教程
    SSH系列教材 (七)- 整合-注解方式
    SSH系列教材 (六)- 使用注解方式配置事务管理
  • 原文地址:https://www.cnblogs.com/liyanwei/p/7591878.html
Copyright © 2011-2022 走看看