Document mode restart using X-UA-Compatible meta tag does not update the Browser Mode correctly in Developer Tools
1. Using IE9
2. Create a test html page using this content:
3. Make sure "Display intranet sites in Compatibility View" is checked.
4. So, your page would normally load using Compatibility View because the box is checked. However, I understand that because of the meta tag, it should now load in IE9 Standards Mode. See the quote from this page:
"EmulateIE9 tells IE to use the doctype to determine how to render content. Web pages with no doctype or a Quirks doctype are rendered in Quirks mode. All other doctypes are rendered in IE9’s Standards mode."
5. With that said, I would expect in Developer Tools that the Browser Mode would say IE9 instead of IE9 Compat View. Lets find out....
6. Push F12 to open Developer Tools.
7. Click on the Script tab and watch the Console.
8. Browse to your page using the name of the server instead of the IP address. Ex: http://mycomputer/test.htm instead of http://127.0.0.1/test.htm.
9. You get the following lines showing up in the console:
HTML1202: http://%YourURLHere%/test.htm is running in Compatibility View because 'Display intranet sites in Compatibility View' is checked. test.htm HTML1113: Document mode restart from IE7 Standards to IE9 Standards test.htm
10. It appears that it first starts to load in Compatibility View but then it sees the header and switches to IE9 Standards.
12. Now look at the Browser Mode in Developer Tools. It says IE9 Compat View. Shouldn't it say just IE9 since it just switched away from Compatibility View.
13. If I am wrong here, can someone please explain why?
So according to that page (http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx) the Browser Mode is what IE sends to the server, wheras the Document Mode is how IE is really rendering the page in the end.
That explains why on the server's side, ASP.net's Request.UserAgent shows IE7; but on the browser's side, window.navigator.userAgent shows IE9.
So this makes me wonder why would I ever want to use X-UA-Compatible to tell the browser to use IE9 Standards mode, when the server is still going to think I'm in IE7 mode? Wouldn't I want both the server and the browser to think they are in the same mode?