如何使WinForms WebBrowser控件与目标版本的Internet Explorer非常相似?

3
我们的WinForms WebBrowser控件针对IE8进行了定位,使用注册表键8000。
以下是我们经常遇到的问题:
  1. 在IE上看不到的脚本错误,在WebBrowser控件中可见。
  2. WebBrowser控件上的网页渲染问题,在IE上正常。
  3. 一些下拉列表在WebBrowser控件上无法工作。

请有人回答我的问题。 - Niranjan Reddy
1个回答

2
  1. Try this code to set the FEATURE_BROWSER_EMULATION.
  2. If you have access to the web pages you're loading into WebBrowser, use X-UA-Compatible:

    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=8" />
        ...
    </head>
    

    You can also try IE=EmulateIE8, the difference is explained here.

  3. Once the above has been done, verify the actual document mode:

    webBrowser.DocumentCompleted += (s, e) => MessageBox.Show(
        ((dynamic)webBrowser.Document.DomDocument).documentMode.ToString());
    

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接