none
Browser mode for WebBrowser control RRS feed

  • Question

  •  

    Hi,

    I have WinForms application using WebBrowser control. 

    It is well known that by default WebBrowser renders pages in IE7 document mode. 
    And there are two ways to make it render pages in "higher" mode:
    1. setup FEATURE_BROWSER_EMULATION key in registry
    2. using meta-tag X-UA-Compatible

    I just wonder if these two approaches are equivalent?
    It seems not, because "meta-tag" approach doesn't change browser mode (As I see user agent string is always  MSIE 7.0 irregardless of value of this tag)
    Actually it seems obvious because browser mode must be known before a page with meta-tag has been received.

    The second question, can I combine these two approaches:
    1. Setup FEATURE_BROWSER_EMULATION  to use current version of IE (if installed IE10, WebBrowser will be forced to use IE10)
    2. If some pages must be rendered in old rendering mode (for example IE7), they will contain  meta-tag X-UA-Compatible with value "IE7".
    So the question is will X-UA-Compatible precedes FEATURE_BROWSER_EMULATION  ?

    Men of experience please help to clarify the case.

    Thank you in advance!



    Tuesday, March 4, 2014 8:35 PM

Answers

  • FEATURE_BROWSER_EMULATION has multiple values per version. The highest one is to force a version regardless of what the author of the page say. This is outlined in its documentation. It is not safe to assume a page will always render correctly in a version unexpected by the page's author. 



    Visual C++ MVP

    • Marked as answer by Eason_H Tuesday, March 11, 2014 9:50 AM
    Wednesday, March 5, 2014 5:16 PM

All replies

  • 1 no, one is for the web developer, one is for the client developer. the client developer has the final say (web is less trustworthy).

    2 no, X-UA-Compatible is too late to change the browser mode. It can only affect document rendering, for example it cannot affect the user agent string received by the server. When the server returns X-UA-Compatible, the request is already made and the server already responded. 

    For more questions on programming the webbrowser control, visit http://social.msdn.microsoft.com/Forums/ie/en-US/home?forum=ieextensiondevelopment.



    Visual C++ MVP

    Wednesday, March 5, 2014 12:13 AM
  • Hi Sheng Jiang!

    But Am I ight that if I setup FEATURE_BROWSER_EMULATION to IE10, and page contains X-UA-Compatible with value "IE7", 
    the document rendering mode will be IE7. 

    So if page is "old" and marked as old with "X-UA-Compatible" it is safe to setup FEATURE_BROWSER_EMULATION as heigh as possilbe.

    Alexander 

    Alexander

    Wednesday, March 5, 2014 8:32 AM
  • FEATURE_BROWSER_EMULATION has multiple values per version. The highest one is to force a version regardless of what the author of the page say. This is outlined in its documentation. It is not safe to assume a page will always render correctly in a version unexpected by the page's author. 



    Visual C++ MVP

    • Marked as answer by Eason_H Tuesday, March 11, 2014 9:50 AM
    Wednesday, March 5, 2014 5:16 PM
  • I've just tried out (with Internet Explorer 11) and the conclusion of my tests is: X-UA-Compatible wins over FEATURE_BROWSER_EMULATION. The registry value of FEATURE_BROWSER_EMULATION is used only if the page doesn't specify X-UA-Compatible.
    Thursday, June 28, 2018 9:11 AM