When to use legacy document modes
Updated: September 2012
In many cases, it's best to use the <!DOCTYPE> directive to specify a standards-based document type. This directive is shown in the HTML5 document type shown this example.
This gives your site the greatest flexibility when viewed with newer browsers and alternate devices.
However, certain business reasons may require you to restrict a webpage to a legacy document mode, one supported by a specific version of the browser. You'll acquire here advice and guidance regarding the effective and appropriate use of legacy document modes.
As mentioned previously, there are situations where it's appropriate to use document compatibility to display your webpages as if they were viewed in an older version of Windows Internet Explorer. Here are a few examples:
If you're creating an application designed to be viewed by a single computer or web browser, such as a multimedia presentation displayed in a kiosk, it might be best to use the
X-UA-Compatibleheader to ensure that the application is displayed consistently, even after updating the hardware or software that powers the kiosk.
If you have created a custom application that's accessed from an Intranet environment, such as a line-of-business (LOB) application developed for a company's internal use, the
X-UA-Compatibleheader can help you reduce maintenance support costs when the operating system or browser are updated.
If you're archiving web content and plan to have that available on an as-is basis, that is, the archived content won't be actively maintained, the
X-UA-Compatibleheader can help ensure that the content will maintain its original presentation.
If your website uses a content management software (CMS) solution or other framework and you don't have direct control over the server or the document type used for your webpage, the
X-UA-Compatibleheader might allow you to control the document mode that Internet Explorer uses to display your webpage. (This depends on the underlying design of the site.)
If there's a strong business reason why you cannot use the latest standards mode supported by Windows Internet Explorer, you can use the
X-UA-Compatible header to direct Internet Explorer to display a webpage as if it were being viewed by an older version of the browser.
By supporting a specific version of Internet Explorer, your users can view your pages while you resolve the reasons why your sites won't display correctly when viewed with browsers that support the latest versions of established and emerging standards.
If you decide to specify the document mode for a webpage, do so deliberately, for example:
- Test the webpage in as many versions of Internet Explorer as you can, including new versions as they are released.
- Set the content value of the
X-UA-Compatibleheader to reflect the specific versions of Internet Explorer supported by your webpage, for example, the ones you've tested.
- Don't set the content value to support versions of Internet Explorer that you haven't specifically tested with your webpage.
If, however, you are creating a public website, one that might be viewed by a variety of web browsers and users, design your site so it uses standards-based document types, such as the HTML5 declaration shown in this example.
Using the HTML5 declaration helps ensure your site is displayed as consistently as possible when viewed by different browsers on different devices. Additionally, it also helps ensure consistency in appearance as your site adapts to changes in the specifications, which drive the standards that your site relies on.
If your site doesn't currently display correctly when viewed by Windows Internet Explorer 9, use the F12 developer tools to identify the cause of the problem. For more info, see Investigating Document Mode Issues.
You can use the
X-UA-Compatible header to make your site available while you redesign it to display correctly when viewed in IE9 standards mode. This is a temporary fix that you can remove when your site more fully supports standards-based document types.
Build date: 11/22/2012