Getting customers off of Internet Explorer 6 (IE6) is certainly one of the priorities within Microsoft – how many other products have countdowns to its demise? But who would have thought that one of the biggest challenges for app compat that keeps people on IE6 is actually a bug fix and not new code or rules?
What’s the bug? In IE6, a DOCTYPE declaration is only ever read if it is the first line of code in the markup. Now, DOCTYPE is what switches you from quirks mode (the default) to standards mode, and the standards say that it does not have to be first. We can’t very well have the standards mode switch not itself be standards compliant, so we kind of had to fix that. But here’s what happens. Let’s say you have markup that starts like this:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
Looks perfectly good, right? In fact, I copied and pasted it from here. But, on IE6, what happens is that we ignore the DOCTYPE and we render it in Quirks mode. Quirks mode has a completely different box model, and renders entirely different from standards mode, even IE6 standards mode.
What I usually find with pages that start like this is that IE8 standards, or even IE7 standards isn’t what breaks them – the pages don’t even lay out correctly using IE6 standards. No, the problem is that the web pages are Quirks dependent, not IE6 dependent – and we still have a Quirks mode!
Of course, there’s no super easy way to jump back to Quirks mode, but you do at least have a few options.
First, if you are modifying the source code, you can just remove that DOCTYPE and get quirks in every version of IE, because you are no longer dependent on the IE6 DOCTYPE bug to land in Quirks mode. If I do that, I also like to tag that website with X-UA-Compatible IE=5 to leave metadata indicating that this outcome was intentional.
If you can’t touch the source code, then you can instead just modify the web server to output the X-UA-Compatible header specifying IE=5.
If you are in the unfortunate position of not being able to touch the server or the page, then there is a hotfix available to allow you to configure web sites to run in Quirks mode via group policy, available here:
Whatever path you choose, there is often a quick way to get some of your applications working more quickly and less expensively. Not that I recommend Quirks mode as something desirable, but updating to support the latest standards takes time and money – ideally you can choose to support the latest standards for applications you introduce, without being forced to reinvest in your entire existing application estate, where the business return for this investment may never materialize.