Windows Internet Explorer 8 introduces document
compatibility modes that allow Web developers to tell the browser to render
their pages in the same way as older versions would. The compatibility mode can
be specified on a per-page or per-site basis.
This document describes how to implement a very common
document compatibility mode, EmulateIE7,
supported by Windows Internet Explorer 8, on a per-site basis, using custom
headers in Internet Information Services (IIS).
For more information concerning the different compatibility
modes supported by Windows Internet Explorer 8 and how to implement them on a
per-page basis, see META
Tags and Locking in Future Compatibility.
Specifying Custom HTTP Response Headers
A document mode can be specified for your Web site by
defining a custom header for the site using IIS Web server. To enable Microsoft
IIS to define a custom HTTP response header that automatically renders all
pages in EmulateIE7 mode, you can
use the following web.config example.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=EmulateIE7" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
You can also configure IIS 7 on a Windows Server 2008-based
computer to include a custom HTTP response header by following these steps:
- Click Start, click Administrative Tools, and
then click Internet Information Services (IIS) Manager.
- In the connections pane, expand the node for the
server, and then expand .
- Click the Web site where you want to add the
custom HTTP response header.
- In the Web site pane, double-click in the section.
- Under Actions, click Add.
- In the Name box, type X-UA-Compatible.
- In the Value box, type IE=EmulateIE7.
- Click OK.
To configure IIS 6 and earlier versions to include a custom
HTTP response header, follow these steps:
- Click Start, click Run, type inetmgr.exe, and
then click OK.
- Expand the server you want and then expand Web
Sites.
- Right-click the Web site you want and then click
Properties.
- Click the HTTP Headers tab.
- Under Custom HTTP headers, click Add.
- In the Custom header name box, type X-UA-Compatible.
- In the Custom header value box, type
IE=EmulateIE7.
- Click OK two times.
If you specify a default document compatibility mode using
your Web server, you can override that setting by specifying a different
document compatibility mode in a specific Web page. The mode specified within
the Web page takes precedence over the mode specified by the server.
Custom HTTP Response Headers and Other Web Servers
For more information about Windows Internet Explorer 8
document compatibility modes and Apache Web servers, read Implementing the META Switch
on Apache.