I have problem with Winforms .NET Class "WebBrowser" after installing of Internet Explorer 11 Preview. It looks like disable javascipt when I call my web page.
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- Is TWebBrowser dependant on IE version?
- How do I bind a DataGridViewComboBoxColumn to a pr
- Partial Form Class C# - Only display code view for
- 反爬能检测到JS模拟的键盘输入吗
If your
WebBrowser
-based app and your web pages still work fine with IE10, the following is likely to be the reason for the problem.In a rather controversial decision, Microsoft has changed the traditional layout of IE User Agent (UA) string in IE11.
This is what the UI string looks like in IE11:
This is what it used to look like in IE10 and older versions:
While a well-designed web page should not rely upon UA string to detect available HTML features, a lot of existing pages still do, and such change may have confused them.
If you have no control over the web pages you load, and cannot fix them, one way to restore the traditional UA string is to force IE7 emulation with
FEATURE_BROWSER_EMULATION
for yourWebBrowser
-based app. Unfortunately, you'd have to go for as low as IE7. Specifying a higher version does't restore the old UA string layout.Another, more flexible but more complex way to fix this is to set up a custom UA string via
UrlMkSetSessionOption
/URLMON_OPTION_USERAGENT
WinAPI. You should retrieve the current UI string withUrlMkGetSessionOption
, parse it, add the missing parts and set it back withUrlMkSetSessionOption
. Do it in thestatic
constructor of yourForm
class, beforeWebBrowser
object gets instantiated.[UPDATE] The code for changing the user agent string: