how to make winforms webbrowser control to work very similar to targeted Internet explorer

a 夏天 提交于 2019-12-04 04:19:19

问题


we are targeting our winforms webbrowser control to IE8 with registry key of 8000.

Below are the issues , frequently we face

  1. Script errors which are not seen on IE are visible using webbrowser control.
  2. web page rendering issues on webbrowser control, works fine on IE
  3. Few dropdownlists doesn't work on webbrowser control

回答1:


  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());
    


来源:https://stackoverflow.com/questions/24723173/how-to-make-winforms-webbrowser-control-to-work-very-similar-to-targeted-interne

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!