1. 程式人生 > >WebBrowser控件默認使用IE9,IE10的方法

WebBrowser控件默認使用IE9,IE10的方法

控件 not sdn xpl ase row bottom dword webpage

最近為了抓取淘寶的成交數據,用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版本如下圖:
技術分享
如果您使用的是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.
Loading...
技術分享
來源: http://extjs.org.cn/fatjames/archives/476

null

WebBrowser控件默認使用IE9,IE10的方法