Testing sites with Browser Mode vs. Doc Mode

With site developers verifying that their sites run well in IE9 and taking advantage of the new HTML5 capabilities and better performance in IE9’s Standards mode, now is a good time to recap how to use Browser Mode and Document Mode to test sites for IE9 and previous IE versions.

In summary, developers can use IE’s Developer Tool’s Browser Mode menu to test how their site will run in different versions of IE. The Document Mode menu is what developers use to determine the best rendering mode for their site in an IE8 and IE9 browser. As we’ve mentioned before, we want sites to run well in the latest standards document mode – IE9’s standards mode in IE9 and IE8’s standards mode in IE8.

Before diving into more detail, let’s start with an overview of IE’s versioning and compatibility system…

Diagram of IE's versioning system

As illustrated above, versioning and compatibility start with Browser Mode. Browser Mode sets how IE will identify itself to web servers and how websites will be handled by default. An important detail to remember is that Browser Mode is chosen before IE requests web content. This means that sites cannot choose a Browser Mode. Instead site developers choose a Document Mode for their site, which overrides IE’s defaults and declares how a website is rendered. If a site does not specify a document mode then IE assumes the default document mode, which is IE9’s standards mode in IE9.

  • Developers can change Browser Mode through the “Browser Mode” menu in IE’s F12 Developer Tools. This setting only applies to the developer’s local machine. For example, developers can have IE9 emulate an IE7 browser, IE8 browser or IE9 in Compatibility View. IE9's F12 Developer Tools Browser Mode menu
  • Users can change Browser Mode by clicking on the Compatibility View (CV) button, which causes IE8 and IE9 to emulate the IE7 browser. This is why it’s important for site developers to test their site in the Compatibility View Browser Mode.
  • IE’s Compat View List can also change the Browser Mode for specific sites.

The Browser Mode determines

Browser Mode



IE9 reports a UA string, version vector, and document mode to match the default browser behavior, which is the most standards-compliant mode in IE9. Use this mode to test how IE9 users experience your site.

IE9 Compatibility View

IE9 reports a UA string, version vector, and document mode, as if it is IE7; however, the UA string also includes the Trident/5.0 token indicating that the browser is really IE9. Use this mode to test how IE9 users experience your site if they click on the Compatibility View button.


IE9 reports a UA string, version vector, and document mode as if it is IE8. Use this mode to test how IE8 users experience your site.


IE9 reports a UA string, version vector, and document mode as if it is IE7. Use this mode to test how IE7 users experience your site.

The Document Mode declares what mode IE’s Trident engine will render the markup in such as IE9’s Standards Mode. Changing the Document Mode through IE’s Developer Tools refreshes the page, but does not resend the UA string or retrieve new markup from the server.

As mentioned before, developers declare the document mode that IE will use when rendering their site. The default document mode is IE9’s Standards mode in IE9. Developers can use the doctype and X-UA-Compatible Meta tag or HTTP Header to change that default as they see fit.

  • Developers can change the document mode on their local machines for testing with the Developer Tools. IE9's F12 Developer Tools Document Mode menu
  • Users cannot independently change the document mode for a site (users can click on the Compat View button, which changes the document mode to IE7 for the site)
  • IE’s Compat View List can change the document mode for specific sites.
  • Developers have ultimate control over what document mode their site runs in by declaring a doctype and X-UA-Compatible Meta tag or HTTP Header.
Document Mode


IE9 Standards

This is the latest standards-compliant behavior available in IE9, and is the default mode used by IE9 to render a webpage that has a strict or unknown document type.

IE8 Standards

This behavior matches IE8 when it renders a webpage that has a strict or unknown doctype.

IE7 Standards

This behavior matches IE7 when it renders a webpage that has a strict or unknown doctype.


This behavior matches IE when rendering a document with no doctype or a Quirks doctype. It is similar to the behavior of IE5 and the Quirks mode behavior of IE6, IE7 and IE8.

Call to action for site developers:
Blog readers have asked why IE9 has document modes for previous versions and when we’ll remove them. As mentioned in previous posts, we have document modes for the IE versions that developers target. These document modes enable developers to update their sites on their own schedule. As long as developers need document modes to run their sites, we’re going to support them. We want to remove document modes as soon as the web transitions to run in the latest standards mode. The timing is really up to developers.

We want as many sites as possible to run in IE9’s Standards mode, which is the default. Many developers really want this too – to make the most of modern capabilities and better performance across the web platform. The best way for a site to do this is to use a standards doctype and no X-UA-Compatible Meta tag or HTTP header. If you’ve determined that the best document mode for your site is not the default, publish the correct X-UA-Compatible Meta tag or HTTP Header on your site so that users experience your site in the mode it was designed and tested for. If your site isn’t running in IE9’s Standards mode, decide on an update plan and get your site running the same standards-based markup across browsers.

After verifying that your site works well in IE9, use IE Developer Tool’s Browser Mode to verify that your site continues to work well in previous IE versions by changing the menu options to IE7 and IE8. If you find an issue, use feature and behavior detection to get your site running well in IE9 and previous IE versions.

Marc Silbey
Program Manager

Comments (43)

  1. David says:

    I partially agree with Rob, but would have stated it a little more elegantly.

    As a developer, I target _standards_, not various IE versions or their document modes.

    I will test in Firefox, Chrome, and Opera.

    Generally only IE has problems rendering my pages. If I can determine that my pages are standard compliant and that the problem is only IE, then I will not waste any energy creating a workaround. When customers file such bugs, I send out a response explaining that it is an IE issue and suggest trying another browser, which resolves most issues.

    That said, so far IE9 is a HUGE improvement over previous versions in regards to standards support. It is not perfect and still has a long way to, but all in all, most of the major problems seem to be fixed. I look forward the final release.

  2. Adrian says:

    I like the developer tools and document modes in IE9.  They let me test a website in IE6, IE7 and IE8 without needing to have those browsers installed.  I used to have to use Windows XP mode to test in IE6.  The only thing I don't like is that the "Done, with errors" icon in the bottom-left corner has gone, so I don't know how to check for Javascript errors anymore.  How do I check for Javascript errors and get a list of the errors in IE9?

  3. jabcreations says:

    Compatibility view should be a design/developer only option not advertised as vocally as it is in IE though that damage has been done. I think the vast majority of dealing with different versions of IE are exceptionally over-complicated. Simple object detection (and I'm not talking about laming out by using the user agent in any possible way) is more then enough to load scripting and style sheets for older versions of IE; it's simpler, quicker, and less painful.

    if (document.getElementById('body').style.scrollbar3dLightColor!=undefined)


    if (document.getElementById('body').style.opacity!=undefined) {/* IE9 */}

    else if (document.getElementById('body').style.msBlockProgression!=undefined) {/* IE8 */}

    else if (document.getElementById('body').style.msInterpolationMode!=undefined) {/* IE7 */}

    else if (document.getElementById('body').style.textOverflow!=undefined) {/* IE6 */}

    else {/* IE 5.5 or lower */}


  4. Thomas Thomassen says:

    Can we get a description of how the document mode is determined when the HTML content is within an embedded webcontrol? Seems to be that the document mode is choosen differently – maybe for compatibility reasons?

  5. Thomas Thomassen says:


    "imple object detection is more then enough to load scripting and style sheets for older versions of IE; it's simpler, quicker, and less painful."

    For style sheets I'd use conditional comments to serve different stylsheets to IE, as it does not depend on JS.

  6. wat says:

    IE6 rendering engine support, pretty please?

  7. Mitch 74 says:

    I can't really say the document mode system has been advertised – you have to open the dev tools first for that (most non-dev users ignore its existence). In fact, the only thing I'd recommend is, the first time the F12 key is pressed, show a warning: "This will open IE's developer tools.If you pressed the key by mistake, click 'Cancel'. To continue, click 'OK'" with a checkbox, unchecked by default, saying "don't ask again".

    Also, a little trick that may be useful: using the meta X-UA-compatible for IE=edge removes the compatibility view button from the toolbar. While I am not, overall, in favour of using useless meta elements, this one is pretty much unobtrusive and frees the (cluttered) URL bar a little.

  8. Max. says:

    Don't you think that you should drop support of IE6 and IE7 standarts? As a developer I test my web-sites in IE8 (and now in IE9 beta too), Safari and Firefox. Theese modes make developers lazy. Instead of rewriting code of the web-page to comply latest popular standarts (IE8 which is pretty good) they just put a compatibility string and do nothing else. And this site looks ugly in other browsers. You're trying to force developers to use HTML5 standarts, but at the same tme allow them to use IE6 non-standarts… It's confusing…

  9. Jesper Kristensen says:

    I think it is great that you allow developers time to transition with backwards compatibility modes. However, please make it up to developers only. It is painful to see that there is still a user oriented compatibility view button in the address bar, that there is still a compatibility list from MS, that it is still the default to display intranet sites in compatibility view, and that it is still possible to put all sites in compatibility view. Please make the choice of IE mode the developer's choice only. That is, only allow it to be changed by doctype, x-ua-compatible and Developer Tools.

  10. Stilgar says:

    @David where do I get customers like these? Mine refuse to pay if the site does not work in IE7, IE8 and soon IE9. At least they are OK with not supporting IE6 anymore.

  11. Niel says:

    @Adrian, @Max – none of these modes allow for IE6 testing.  For those still supporting IE6, my condolences.

    It is important to note that the browser mode is ONLY a **SIMILAR** rendering behavior to a previous version of IE.  It in NO WAY WHATSOEVER can be used as a replacement for testing in an actual IE7 install – there are many rendering differences in IE8/IE9 (faking IE7) to a vanilla IE7 install.

  12. Rob says:


    document.getElementById('body')  ????????????


    document.body.style (I think… I have seen moster web pages with no head, two bodies, and preceeding comments to the DTD… IE's error handling may trigger a documentMode switching if there are excessive markup errors or  …. See Internet Options, Advanced tab, "Automatically recover from rendering errors with Compatibility View")

    of coarse ALL feature tests wil fail if scripting in the browser has been disabled… This again brings challenges… in the Restricted Sites zone both scripting and meta refresh is disabled. In other browsers there is no such security zone model… browsers may have scripting disabled but meta refresh is unbridled.

    of coarse <noscript><meta…… /></noscript> is invalid in both the <head> and <body> blocks… moral… use


    <noscrip><p>click this link to go to the nonscripted version of this site<a href="noscript.htm">here</a> or enable scripting in your browser</p></noscript>

  13. Rob says:

    this seems to work well…

    function getIEVersion(odoc){

    if (odoc.body.style.scrollbar3dLightColor!=undefined)


    if (odoc.body.style.opacity!=undefined) {return 'IE9';}

    else if (odoc.body.style.msBlockProgression!=undefined) {return 'IE8';}

    else if (odoc.body.style.msInterpolationMode!=undefined) {return 'IE7';}

    else if (odoc.body.style.textOverflow!=undefined) {return 'IE6'}

    else {return 'IE5.5 or lower';}



    but I only tested it in IE9 on Vista and IE Tester. Not the real M'coyIEs or in FX, Chrome or Opera

  14. Brian LePore says:

    I've mentioned this before in other blog posts on the topic, and while I have gotten replies, I still do not understand why conditional comments are a part of the browser mode and not the document mode. The document mode is used to determine layout engine will be run. Many developers use conditional comments to target specific engines in IE to apply additional patches such as CSS or JavaScript files. For example, a site might include a script to apply some type of rounded corners for IE8 and below, but not fo IE9. As a developer I could say that my site is using the IE9 rendering engine, but if the user changes the browser mode to a lower version of IE then the unnecessary CSS/JavaScript files would execute from the conditional comments and potentially break the site layout.

  15. om-kr says:

    Are there any plans to support AnimationPNG?

    The image is a geostationary situation when inspecting it with IE though there is a site where APNG such as Pixiv can be used, too.

  16. Robert says:

    Does this mean that Microsoft's suggested test environment for IE7/8 is IE9, and not virtual machines with IE7 and IE8?  I was under the impression that the IE7 compatibility mode in IE8 was not one-for-one compatible with the real IE7, which introduces the opportunity to miss real-world bugs if you're testing against browser modes rather than actual browsers.  Actually, I just ran the acid tests on IE7 and IE8 in Compat mode, and there are definitely rendering differences.  Can anyone verify that IE9's IE7 mode is one-for-one the same as real IE7, and that IE9's IE8 mode is one-for-one the same as real IE8?  If it's not, like IE8 compat mode is not the same as IE7, I don't see how Microsoft can actually suggest we do our cross browser testing all inside of IE9.

  17. johnnyq3 says:


    APNG isn't a W3C standard more like a independent iniative by Mozilla and Opera.  IE will not support it unless it is a MSDN thing or W3C standard.

  18. MarcSil [MSFT] says:

    @Adrian: You can view javascript errors through the F12 Developer Tools Console of the Script tab or in the Console tab itself. If you don’t want to keep Dev Tools up, you can get a notified when there is a script error by checking “Display a notification about every script error” in the Advanced tab of Internet Options. You can get to Internet Options by clicking on the gear icon in the upper right corner of IE.

    @Thomas: Thanks for raising that question. The WebBrowser Control determines the doc mode the same way that IE does because it contains the same web platform (e.g. there is one shared mshtml.dll across IE and WebBrowser Control hosts). The WebBrowser Control does default to the Compatibility View browser mode, which means that the default doc mode is IE7. Here is a blog post with more detail on this: blogs.msdn.com/…/more-ie8-extensibility-improvements.aspx.

  19. Randy says:

    Interesting that the first Rob's comments were deleted so I'll restate them. Looking through all this shows how IE makes our jobs harder by piling on additional, unnecessary work. That is, work that is not and should not be needed to render things from the web. They add no value other than to make IE fit in with the rest of the modern world.

    As Rob implied, looking at all this makes me sick to my stomach.

  20. APNG fan says:

    No, apng is not a standard but still MS ought to support it all the same (as they ought to put in native browser support for webM too – Google did the right thing here by supporting both video formats – all browsers should do that). Gif belongs at the web-museum next to Pacman and the likes and if enough browsers support apng it *will* eventually become a standard – a little faster than it seems for now.

  21. ken says:

    Why was Rob censored? Did he use profanity or personal attacks? Just making his post disappear doesn't look very good…

    In regards to CV and so forth… DO NOT WANT!!

    One step forward, two steps back…

  22. Dennis Becker says:

    Great to know the differences between Browser Mode and Document Mode.

    What I would like to know is, how can I use IE9s Document Modes (IE7 and IE8) with a tool like Selenium, so that I can test my website in all 3 Document Modes? At the moment, I have different Virtual Machines to solve this problem, but it is really annoying to shutdown and start the next Virtual Machine just for testing puposes.

  23. hannsg says:

    man, you guys could have saved yourselves a lot of work if you had just adopted standards from the beginning.

  24. Gordon says:

    And now for real news of importance….. Google just released Google Chrome 7! yet another smoking fast release of the worlds best web browser (oh, and it runs on Windows XP, unlike the IE9 beta)

    Download it right away here: http://www.google.com/chrome

    If your users are still stuck with IE, be sure to suggest they upgrade to Google Chrome, or install the Google Chrome frame to experience the real web, inside IE.

  25. johnnyq3 says:


    You know that for enterprise solutions Chrome is the worst kind of solution.  They are already going to release Chrome 9 as a Dev build.  The update schedule that Google uses is random and too quick for Business to deal with.

  26. Randy says:

    @johnnyq3 – And enterprises are still using IE6 so they created their own problems by using IE in the first place. I understand the issue of having to upgrade all those workstations but Chrome auto updates. In any case, we shouldn't diss a browser or software because it advances too rapidly. Unlike IE which advances rarely.

  27. Mitch 74 says:

    A little while ago, I complained that IE's auto-managed  cache didn't always work correctly – that, when pressing Ctrl+F5, some elements were kept in cache eventhough they shouldn't.  and I was told that no, IE's cache works perfectly.

    Well, I had proof this very afternoon (five minutes ago, as a matter of fact), that IE 8's cache management still SUCKS – as it required me to flush the cache completely to update background images I was loading through a CSS file. And no matter how many times I closed IE, or tried to do Ctrl+F5, these images were still loaded from cache and NOT from the website.

    So, maybe IE correctly reloads elements loaded directly through the page – but the resources these elements require SHOULD BE REFRESHED TOO!

    I do hope IE 9's cache really got an overhaul – IE 8's just wasted an hour of my time.

    On the other hand, Firefox, Chrome, Opera and Safari correctly update their elements and will, anyway, properly reload all page content when asked to.

  28. blackx says:

    If MS's stuff has gotten so much better, how come i have a remote user with Vista and IE8 who's Internet access has been crippled by a virus.  Are the bad guys just better programmers than the people who work at MS?  Is it simply a matter of, no matter what, MS just cannot make a safe product?

  29. starks says:

    ieteam, you need to be more humble and forthcoming about your flawed approach to legacy rendering.

  30. Prior Semblance says:


    You can get a virus in any browser and you can get a virus from stuff which has nothing to do with the browser.  Plus IE and Windows are the largest targets for viruses right now due to their high levels of use.  Are you really using a single person as an example that an entire company is flawed?

  31. A voice says:

    I wore my vibram five fingers while hiking in Scotland one year. I walked the West Highland Way, which took me around a week and wore my Vibrams every second day. My feet left rather dramatic marks in the Highland mud and on large rocks that lay strewn across the mountains. In fact,  I was surprised to hear rumours of Big Foot behind us on the trail … until somebody recognised similar tracks leading to me!

  32. If you feel Mbt shoes look weird says:

    If you feel Mbt shoes look weird, but not necessarily in a bad way. The first thing you'll notice is the extremely thick and curved sole. If you set one of the shoes on the floor, and look at if from the side, you see that the parts of the sole under the toes and the heel do not actually hit the floor. It's the basic make you have a health.

  33. Phil says:


    Here's the quote from W3C: "There is no limit in the Web specifications to the graphical formats that can be used on the Web".

  34. raw says:

    The iframe element should follow the css border:none and overflow:hidden to hide the border and scrollbar.

    frameborder and scrolling are no longer allowed in the HTML 5 spec.

  35. Miller says:

    This is all very good but we haven't heard when Microsoft is planning to finish adding codec support for HTML5 Video/Audio.  We haven't heard that IE9 will support webM format for video, Ogg Theora for video, and Ogg Vorbis for audio (mp3 too would be ideal).

    Just finished reading an HTML5 book, and once again, even before HTML5 gets into prime time IE is still holding back the web.

  36. Prior Semblance says:


    There is no "finish" when it comes to codecs, the browsers add whatever codecs they want.  There is no list of codecs that they complete and then they are done.  It would be great if IE9 supported ogg, but it's not required.  I'd actually love to see more browsers support AAC, but I believe that IE9 is one of the few that does.

    Oddly enough, you asked IE9 to add mp3 support but they already have it.  It's Opera and Firefox which don't support mp3.

    Finally, every browser is holding HTML5 back right now because all of them are missing features.  For audio, Opera and Firefox are missing mp3, chrome is  the only one missing wav and safari/ie9 are missing ogg.  Even HTML5 is holding itself back right now because its not finished yet.

  37. Thomas Thomassen says:

    @MarcSil (re: WebBrowser Control)

    The problem with using registry entries to select document mode for WebControl is that it applies to the application as a whole. I write plugins for Google SketchUp where you have WebDialog windows to create UIs – it's just a WebBrowser control in a window. But that leads to problems as I want to force a document mode for my instance of the WebBrowser control, not for all of SU's WebBrowser controls as a whole.

    So, my question is: how do you control the document mode per instance for a WebBrowser control?

  38. DaivdPaulo says:

    IE9 always crashes  when i change the document mode to quirks mode at GMail.  see the bug report: 602814

  39. johnnyq3 says:


    Last time I check, Theroa was dropped as a proposed codec, and MS supports a Codec for WebM.

    @Prior Semblance

    IE9 supports the ogg codec if you install the oog with the xiph codec pack.

  40. yellowstone says:




  41. red brick says:


    Yes, we know that IE9 supports JPEG XR.

    Why do you keep beating us over the head with it?

  42. Ichao says:

    The browser mode /and/ the Document Mode determine how Conditional comments are evaluated. connect.microsoft.com/…/conditional-comments-broken "This is the expected behavior for X-UA-Compatible. This switches conditional comments to evaluate as if you're the version of IE specified in the meta tag. The idea is that a web developer has a site they know works in IE7 and which might depend on conditional comments as they evaluated in IE7. X-UA-Compatible is designed to be a simple way to get back the same behavior as IE7. If conditional comments always evaluated to the "true" IE version, many sites would break even though they added X-UA-Compatible."

  43. Some Guy says:

    I run a pretty good sized global development shop and we're still seeing 10-30% IE6 in our user base, depending on the site and country.  So very sad.  The developers pull their hair out trying to make modern functions just behave on IE6, while the business can't understand why their IE6 browser doesn't do the cool new things…

    And like Wat said above, it'd be so nice to include the browser engines.  As it is now, we have to use VM's with different versions of IE6 to do our testing.