Freigeben über


Configuring IIS to work around webpage display issues in Internet Explorer 8.0

Special thanks to Sean Everhart for contributing this topic 

 

Internet Explorer 8.0 introduces a new method of interpreting and displaying the HTML data sent from web servers.  In some cases, this can result in the web pages being displayed to users incorrectly.  For example the pages may display with incorrect layout, or with overlapping text and images.  Unless a web site author designs their web pages with Internet Explorer 8.0's new methodology in mind, these display issues may occur.

To workaround these display issues, it is possible to make configuration changes in IIS so that special instructions are sent along with the HTTP response, telling IE8 browsers to display the data the same way IE7 would.  The steps listed below show how to add the IE=EmulateIE7 HTTP header Server-Wide on both IIS 6 and IIS 7. These settings can also be changed at the site, virtual directory or any level in the configuration. The steps are included to make these changes from both the User Interface (UI) and from the command-line.

 

Internet Information Services (IIS) 7.0

Configuring the EmulateIE7 HTTP Header in IIS7 (via the user interface) 

  1. Open Internet Information Services (IIS) Manager
  2. Select the Server from the connections pane
  3. Right-click on “HTTP Response Headers” from the center task pane, and choose “Open Feature”
  4. Select “Add” from the Actions Pane
  5. Add a custom header with the Name “X-UA-Compatible” and the Value “IE=EmulateIE7”

 

Configuring the EmulateIE7 HTTP Header in IIS7 (via the command line)

  1. Open an elevated command prompt 
  2. Navigate to the “%systemroot%\system32\inetsrv” directory
  3. Execute the following command:

 

appcmd.exe set config -section:system.webServer/httpProtocol /+"customHeaders.[name='X-UA-Compatible',value='IE=EmulateIE7']" /commit:apphost

 

Configuring the EmulateIE7 HTTP Header in IIS7 (via applicationhost.config)

1. Open a command prompt
2. Navigate to the “%systemroot%\system32\inetsrv” directory
3. Open the “applicationhost.config” file in notepad
4. Modify the httpProtocol section to include the “X-UA-Compatible” header:

 

<httpProtocol>

     <customHeaders>           <clear />           <add name="X-Powered-By" value="ASP.NET" />           <add name="X-UA-Compatible" value="IE=EmulateIE7" />      </customHeaders>

     <redirectHeaders>           <clear />      </redirectHeaders>

</httpProtocol>

 

Internet Information Services (IIS) 6.0

Configuring the EmulateIE7 HTTP Header in IIS6 (via the user interface) 

  1. Open Internet Information Services (IIS) Manager 
  2. Select the Server from the left pane 
  3. Right-click on “Web Sites” and select “Properties” 
  4. On the “HTTP Headers” tab, select “Add” in the “Custom HTTP Headers” section: 
  5. Add a custom header with the Name “X-UA-Compatible” and the Value “IE=EmulateIE7”

 

 Configuring the EmulateIE7 HTTP Header in IIS6 (via the command line) 

  1. Open a command prompt 

  2. Navigate to the IIS adminscripts directory, by default at C:\Inetpub\Adminscripts

  3. Execute the following command to determine if any custom headers exist: 

     

adsutil get w3svc/HttpCustomHeaders

 

The list will be empty and show 0 items, or there will be items in the list. In this example, there is one existing custom header: 

 

HttpCustomHeaders : (LIST) (1 Items) "X-Powered-By: ASP.NET"

 

  1. If the list is empty, add the header with the following command:

 

adsutil set w3svc/HttpCustomHeaders "X-UA-Compatible: IE=EmulateIE7"

 

  1. If the list is not empty, append the custom header with following command:

adsutil set w3svc/HttpCustomHeaders "X-Powered-By: ASP.NET" "X-UA-Compatible: IE=EmulateIE7"

(Where "X-Powered-By: ASP.NET" is the existing custom header)

 

 

The following examples shows the raw IIS responses before and after adding the custom HTTP header:

IIS7

 

Default Response

Response with Custom Header

HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nLast-Modified: Fri, 01 Aug 2008 06:43:34 GMT\r\n Accept-Ranges: bytes\r\nETag: "467a83eba1f3c81:0"\r\n Server: Microsoft-IIS/7.0\r\n X-Powered-By: ASP.NET\r\n Date: Tue, 19 Aug 2008 23:05:24 GMT\r\n Content-Length: 689\r\n

HTTP/1.1 200 OK\r\n Content-Type: text/html\r\n Last-Modified: Fri, 01 Aug 2008 06:43:34 GMT\r\n Accept-Ranges: bytes\r\n ETag: "467a83eba1f3c81:0"\r\n Server: Microsoft-IIS/7.0\r\n X-Powered-By: ASP.NET\r\n X-UA-Compatible: IE=EmulateIE7\r\n Date: Tue, 19 Aug 2008 23:19:12 GMT\r\n Content-Length: 689\r\n

 

IIS6

 

Default Response

Response with Custom Header

HTTP/1.1 200 OK\r\n Content-Length: 1433\r\n Content-Type: text/html\r\n Content-Location: https://iisserver/iisstart.htm\r\n Last-Modified: Thu, 24 Mar 2005 21:19:08 GMT\r\n Accept-Ranges: bytes\r\n ETag: "06e611db730c51:315"\r\n Server: Microsoft-IIS/6.0\r\n Date: Tue, 19 Aug 2008 23:50:47 GMT\r\n

HTTP/1.1 200 OK\r\nContent-Length: 1433\r\n Content-Type: text/html\r\n Content-Location: https://iisserver/iisstart.htm\r\n Last-Modified: Thu, 24 Mar 2005 21:19:08 GMT\r\n Accept-Ranges: bytes\r\n ETag: "06e611db730c51:31f"\r\n Server: Microsoft-IIS/6.0\r\n X-UA-Compatible: IE=EmulateIE7\r\n Date: Wed, 20 Aug 2008 00:23:27 GMT\r\n

 

More Information

Your Web site may not display correctly in Internet Explorer 8 Beta 1

https://support.microsoft.com/kb/952030

 

IIS 7.0: Add a Custom HTTP Response Header

https://technet.microsoft.com/en-us/library/cc753133.aspx

 

IIS 6.0 F1: Add/Edit Custom HTTP Header

https://technet.microsoft.com/en-us/library/cc725672.aspx

Comments