最近爲了抓取淘寶的成交數據,用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模式,則註冊表的內容當即生效!less
2017-07-19補充IE11的使用方法ide
- 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.