I maintain a legacy web application that has a lot of old quirks mode pages, and a lot of newer standards mode pages.
In IE10, if our domain name is in IEs compatibility list, I am getting a mixed message from IE.
If I change Browser Mode in dev tools from IE10 Compat View to IE10 and then back to Compat View, I get:
Do IE10 dev tools misrepresent the browser mode sometimes? For example guessing the mode based on the Compatibility list or other criteria, when the page in fact enters standards mode because of the doctype and X-UA-Compatible set to IE=edge?
Or is the documentMode and userAgent not reliable to test what mode we're in?
Basically, we want to tell users "hey, you don't need to put our site in your Compatibility View list anymore" if we detect they are in that mode.
Testing the User-Agent string is enough to determine whether the page is in Compatibility View mode or not. And if the UA string is MSIE 10.0, Trident/6.0
, you can trust that the page is in IE 10 Standards mode. So in the first case, I would not trust the “Browser Mode: IE10 Compat View” being reported by developer tools, as born out by your observation of the appearance of the page suggesting Standards mode.
For your situation, if that is the UA string in the request, that means that the Compatibility View settings list is not being respected. The Browser Mode and UA string are generated before the request is made, so they are not affected by the X-UA-Compatible
tag or doctype
from the response. For whatever reason, it seems that IE10 is not respecting the entry in the Compatibility View Settings list for your domain. Here’s an illustration of that process from MSDN:
(source: microsoft.com)
As far as I know, you can rely on the user agent string to determine when to inform your visitors that they can remove your site from their Compatibility View Settings list (or deselect the Compatibility View button). Specifically, if the string is MSIE 7.0, Trident/6.0
, the browser mode is Internet Explorer 7 and the browser, as indicated by Trident/6.0
, is IE10.
There is a really good blog post from MSDN (where the graphic above comes from) about IE9 that goes in detail through browser mode vs document mode and specifies the behaviour of the browser and UA strings in those different situations. Unfortunately, I have not found a similarly detailed post about IE10, but I’m guessing/hoping that the behaviour is similar.
Final note: when you say the web app has a lot of old quirks pages, I worry about the confusion between Document Mode (Quirks) and Browser Mode (Compatibility View). I am guessing this is not a part of your issue, but because that distinction has tripped me up in the past, I just want to mention it here.