Internet Explorer 8 and Internet Explorer 9 include a Compatibility View feature that displays websites that were created for older browsers as they were designed to appear with Internet Explorer 7. You can enable Compatibility View in Internet Explorer or on the Web server.
- For general users and for advanced users
- For system administrators
- For website content developers and for website administrators
For general users and for advanced users
Method 1: Enable Compatibility View for specific websites in Internet Explorer
To enable Compatibility View for specific websites that are not displayed correctly or that are not working correctly, follow these steps:
- Open the website that is not displayed correctly or that does not work correctly in Internet Explorer 8 or in Internet Explorer 9.
- Click the Compatibility View button that is located directly to the right side of the address bar next to the Refresh button.
Or, on the Tools menu, click to select the option Compatibility View. If the Tools menu is not displayed, press ALT to display the Tools menu.
Note- If the Compatibility View button does not appear on the right side of the address bar, or if the command is not available under the Tools menu, you cannot use this method. You may be experiencing a different problem, or the network administrator may have used a Group Policy setting to configure the Compatibility View settings on your computer.
- If you are using a home computer, see the "Similar problems and solutions and support information" section for alternative steps.
- If you are using a computer in an enterprise environment, contact your administrator or the help desk.
- If the Compatibility View button does not appear on the right side of the address bar, or if the command is not available under the Tools menu, you cannot use this method. You may be experiencing a different problem, or the network administrator may have used a Group Policy setting to configure the Compatibility View settings on your computer.
- If this method worked, you may have to repeat this method for each website that experiences these problems.
Note When you use this method to fix a website, Internet Explorer saves your Compatibility View setting for that website. Every time that you visit that site, Compatibility View will be used. To stop a website from running in Compatibility View, follow these steps:
- Click Tools, and then click to select option Compatibility View.
- You can also add or remove specific websites from Compatibility View without actually visiting each website.
If this method did not work, you are experiencing a different problem. See the "Similar problems and solutions and support information" section for alternative steps.
Method 2: Enable Compatibility View for all websites in Internet Explorer
You have tried Method 1 on some of these websites, and that method worked. However, you may want to enable Compatibility View for all websites. To do this, follow these steps:
- Start Internet Explorer 8 or Internet Explorer 9.
- On the Tools menu, click Compatibility View Settings. If the Tools menu is not displayed, press ALT to display the Tools menu.
If Compatibility View Settings is not available, the network administrator may have used a Group Policy setting to configure the options for you. Contact your administrator or the help desk. - Click to select the Display all websites in Compatibility View check box, and then clickClose.
- Visit several websites that were not displayed correctly or that were not working to see whether the problem is now resolved.
If this method did not work,you are experiencing a different problem. See the "Similar problems and solutions and support information" section for alternative steps.
For system administrators
Method 1: Enable Compatibility View for multiple computers by using Group Policy settings
To enable Compatibility View for multiple computers in an enterprise environment, administrators can use the following new Compatibility View Group Policy settings that are available for Internet Explorer 8 and for Internet Explorer 9:
- Turn on Internet Explorer 7 Standards Mode: This setting enables Compatibility View for all websites and prevents users from enabling or disabling Compatibility View for any websites.
- Turn off Compatibility View: This setting disables Compatibility View for all websites and prevents users from enabling or disabling Compatibility View for any websites.
- Turn on Internet Explorer Standards Mode for Local Intranet: This setting disables Compatibility View (enables Standards Mode) for all intranet websites.
- Use Policy List of Internet Explorer 7 sites: This setting lets administrators add specific sites that must be viewed in Compatibility View. Users can add or remove sites from the list. However, they cannot remove sites that are specified by the administrator.
- Turn off Compatibility View button: This setting prevents users from using the Compatibility View button to try to fix websites.
These settings are available for both Users and Computers in the following location for each site, domain, and organizational unit:
Administrative Templates/Windows Components/Internet Explorer/Compatibility View
For website content developers and for website administrators
The following information is intended for Web content developers and for website administrators. To give you time to transition your Web content to Internet Explorer 8 Standards mode, you can specify that your content should always be viewed in Compatibility View. To enable Compatibility View for your whole website, use Method 1. To enable Compatibility View for specific webpages, use Method 2.
Note When you use either of these methods, Internet Explorer 8 displays your whole site or a specific page in the same manner that Internet Explorer 7 displays the website. Specifically, Internet Explorer will render pages either in Internet Explorer 7 Standards (Strict) mode or in Internet Explorer 5 (Quirks) mode, depending on the Doctype element declaration.
These methods should address most display and functionality issues. However, your browser detection code may also have to be updated on your site.
To learn more, visit the following Microsoft website:
To verify that you have installed the tag correctly on your site, follow these steps:
- If you do not have Internet Explorer 8 installed, you can download it by visiting the following Microsoft website:
- Browse your site in Internet Explorer 8 Standards mode, and verify that you do not encounter the issues that are described in the "Symptoms" section.
For more information about document compatibility, visit the following Microsoft websites:
For more information about Cascading Style Sheets Compatibility in Internet Explorer, visit the following Microsoft website:
Method 1: Enable Compatibility View for your whole website or for specific website directories
To enable Compatibility View for your whole website or for certain website directories, include the following custom HTTP header for all requests to your site or directory.
X-UA-Compatible: IE=EmulateIE7
To do this in Internet Information Services (IIS) on a Windows server-based Web server, you must either add a custom HTTP response header in IIS or configure the Web.config file for the appropriate directory.
Add the custom HTTP response header in IIS
To add a custom HTTP response header at the website level, at the folder level, or at the virtual directory level in IIS, follow the steps for the version of IIS that you are using.
IIS 7 on a Windows Server 2008-based Web server
- Start IIS Manager. To do this, click Start, click Run, type inetmgr, and then click OK.
- Under Connections, double-click the server that you want, and then double-click Sites.
- Click the website, the folder, or the virtual directory where you want to add the custom HTTP response header.
- Under <website name> Home, double-click HTTP Response Headers in the IIS section.
Note The <website name> placeholder refers to the name of the website. - Under Actions, click Add.
- In the Name box, type X-UA-Compatible.
- In the Value box, type IE=EmulateIE7.
- Click OK.
IIS 6 and earlier versions
- Click Start, click Run, type inetmgr.exe in the Open box, and then click OK.
- Expand the server that you want, and then expand Web Sites.
- Right-click the Web site, the folder, or the virtual directory that you want, and then clickProperties.
- On the HTTP Headers tab, click Add under Custom HTTP headers.
- In the Custom header name box, type X-UA-Compatible.
- In the Custom header valuebox, type IE=EmulateIE7.
- Click OK two times.
Add the custom HTTP response header in the Web.config file
To add this header to the Web.config file, create or revise the Web.config file as follows.
<?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>
Note Add this new or revised Web.config file to each Web directory in which you want to use compatibility mode.
Method 2: Enable Compatibility View for specific webpages
Use the <Meta> tag
To enable Compatibility View for specific webpages, use the following <Meta> tag after the <Head> tag on the page.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
This tag overrides any HTTP header declaration in the HTML for a particular webpage.
The following sample code shows how to use this Internet Explorer 7 compatibility mode tag on a per-page basis.
<html>
<head>
<!-- Use IE7 mode -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>My Web Page</title>
</head>
<body>
<p>Content goes here.</p>
</body>
</html>
Important To make sure that the compatibility meta tag is used correctly, we recommend that the compatibility meta tag is positioned immediately after the <Head> tag and before any other metadata. Failure to correctly position the compatibility meta tag may cause Internet Explorer 8 to ignore the value and to continue to render in Internet Explorer 8 Standards mode.
Use HTTP response headers
If you use ASP.NET themes, use an HTTP response header to enable Compatibility View. To enable Compatibility View for an entire site, use an HTTP response header in the Global.asax file. If your site uses the Single-File Page model or the Code-Behind Page model, use an HTTP response header on each page.
Sample code
- Global.asax
void Application_BeginRequest() { Response.AppendHeader("X-UA-Compatible", "IE=EmulateIE7");
- Single-File Page model
<html xmlns="http://www.w3.org/1999/xhtml"> <% Response.AppendHeader("X-UA-Compatible", "IE=EmulateIE7"); %> ... </html>
- Code-Behind Page model
protected void Page_Load(object sender, EventArgs e) { Response.AppendHeader("X-UA-Compatible", "IE=EmulateIE7"); }
If you cannot use HTTP response headers in your environment, you can use code to move the <Meta> tags immediately after the <Head> tag. The following sample code shows how to do this in the Global.asax file or in an HTTP module.
void Application_PreRequestHandlerExecute() {
var page = Context.Handler as Page;
if (page != null) page.PreRenderComplete += delegate {
var head = page.Header;
if (head != null) {
var q = from Control c in head.Controls where c is HtmlMeta select c;
foreach (var c in q.ToArray().Reverse()) {
head.Controls.Remove(c);
head.Controls.AddAt(0, c);
}
}
};
}
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
For more information about how to define document compatibility in Internet Explorer, visit the following MSDN website:
No comments:
Post a Comment