Partager via


Configuring web servers to specify document modes

The X-UA-Compatible header allows web developers to specify the document modes supported by a webpage. Here we learn how site administrators can configure their web servers to serve sites so that they default to a specific document compatibility mode by defining a custom header for the site. The specific process depends on your web server. For example, the following web.config file enables Microsoft Internet Information Services (IIS) to define a custom header that automatically renders all pages in standards mode.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=10" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration> 

Document modes specified through a web server have a lower precedence than document modes specified in a webpage. Meaning, if your server specifies IE9 Standards mode for a given webpage, but the page contains a meta element that specifies IE8 Standards mode, the webpage will be displayed in IE8 mode by versions of Internet Explorer that support that document mode.

Review the documentation of your particular web server for information about specifying custom headers. For more info, see:

Defining Document Compatibility