Published 2012-03-06 06:05 by Leif Halvard Silli.
That Internet Explorer version 10 does not support conditional comments — and also does not know (but neverthelss knows …) the X-UA-Compatible meta element — undeniable made an impression on me when it finally dawned on me … So strong was the impression, that I made up that IE10 did not support X-UA-Compatible unless the browser is in quirks.mode.
So when I visited ie.microsoft.com with IE10, I was surprised to see that it switched to IE9 document mode.
How could that be? Well, there was really only one possible answer, according to my earlier tests: That the page was in quirks mode from begin with. And sure enough: When I selected Source➜Original in the View menu of the Developers toolbar, it showed this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE html>
(Yes, for some reason the second DOCTYPE has ‘html’ in lowercase.)
That is: A valid HTML4 DOCTYPE, which triggers quirks mode, is the first doctype of the document. For non-IE browsers, the first header does not occur in the code — hence in those browsers, you instead see an empty line as the first “content”.
Why do Microsoft’s Web designers add that quirks-mode doctype? Answer: Because they are occupied with controlling IE’s parsing mode via X-UA-Compatible, which works even in IE10, as long as the page is placed in Quirks-Mode … So someone has second thoughts about IE10’s lack of support — in non-quirks-mode — for X-UA-Compatible …
As I inspected the source code as described above, I also saw another thing: Every mark-up tag was uppercased. So instead of <p>, i displayed <P> — for instance. And this allowed me to assume another thing: That the page was served with an X-UA-Compatible header via HTTP. (Quite strange, you might say, because X-UA-Compatible is also present in the source code of the page!)
And rightly so: When I inspected the HTTP headers with iCab’s excellent Console tool, I found this: X-UA-Compatible: IE=9
So this conformed what I have said earler on this site, that sending the X-UA-Compatible command as a HTTP header, can cause the source code’s tags to display as uppercased in IE. Another, probably related effect, is that the rendered DOM does not display in the Developers tool.
Why does it happen? Does it actually have any negative effects? I don’t know why it happens other than that it is related to sending the X-UA-Compatible command as HTTP. I also don’t know if it has any negative effects. The most serious negative effect might very well be the gotcha someone trying to copy the source code would get. After all, it is quite confusing to have selected the origional source (again, I selected Source➜Original the Developer tool), and not get the original source ….
And by the way: I have set Notepad++ ad my source editor. So when I view the source in Notepad++ instead of inside the Developer toolbar, then I do not see the problem.
That even Microsoft places Web pages in Quirks-Mode in order to be able to control the mode via X-UA-Compatible, says a lot about what we can expect other developers to do as well — not? In theory, IE10 could lead to increased use of quirks-mode.
And: I stand by my advice to be sceptical about sending X-UA-Compatible as HTTP.
« And Microsoft saw that it was goo … Google! | White spots in HTML5's encoding sniffing algorithm »
© 2013 Leif Halvard Silli