About IE8 compatibility: Explanation of the X-UA-Compatible attribute

About IE8 compatibility: Explanation of the X-UA-Compatible attribute

Problem description:


Copy code
The code is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />

1. What does this mean?

2. Some examples use "," to separate IE versions, while some use ";", which one is correct?

3. I want to know the meaning of the order IE=9; IE=8; IE=7; IE=EDGE.

In the document, <!DOCTYPE>

reply:

For IE8 and above, for example:


Copy code
The code is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7" />

Force the browser to render according to a specific version of the standard. But IE7 and below are not supported. If separated by a semicolon (;), different browser versions will have different compatibility, for example

Copy code
The code is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=7; IE=9" />

The above shows that IE8 and IE7 are rendered according to IE7 standards, but IE9 is still rendered according to IE9 standards. This allows for different levels of backward compatibility. In reality though, you only need to choose one version:

Copy code
The code is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=8" />

This will be easier for testing and maintenance. A more useful approach is usually to perform simulation

Copy code
The code is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />

For IE=EDGE

Copy code
The code is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

This means that the browser will be forced to render according to the latest standards. Just like using the latest version of jQuery from Google's CDN, this is up to date, but may also break your layouts without a fixed version.

Finally, consider this

Copy code
The code is as follows:
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

Adding "chrome=1" will allow the site to render on clients that use Chrome Frame, but will have no effect on clients that don't.

Copy code
The code is as follows:

For more information, there is plenty to read here, and if you want to learn about ChromeFrame (which I recommend) you can learn about its implementation here.

PS: X-UA-Compatible is a special file header tag for IE8 version, which is used to specify different page rendering modes for IE8. It is not recognized by browsers other than IE8.

Currently, most websites use <meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ > as a compatibility method for IE8. In order to avoid errors in the produced pages under IE8, it is recommended to directly render IE8 using IE7. That is, add the following code directly to the meta tag of the page header:

Copy code
The code is as follows:

<meta http-equiv=”X-UA-Compatible” content=”IE=7″ /></p> <p><meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ ></p> <p><meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE8″ >

But <meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ > is still the preferred choice.

StackOverFlow original link; http://stackoverflow.com/questions/14611264/x-ua-compatible-content-ie-9-ie-8-ie-7-ie-edge?answertab=active#tab-top

<<:  Solution to Incorrect string value in MySQL

>>:  Teach you how to use Portainer to manage multiple Docker container environments

Recommend

Detailed explanation of moment.js time and date processing

Monday to Sunday time format conversion (Y --- ye...

Vue implements a simple calculator

This article example shares the specific code of ...

CSS3 realizes various graphic effects of small arrows

It’s great to use CSS to realize various graphics...

How to reasonably use the redundant fields of the database

privot is the intermediate table of many-to-many ...

Achieve 3D flip effect with pure CSS3 in a few simple steps

As a required course for front-end developers, CS...

JS ES new features: Introduction to extension operators

1. Spread Operator The spread operator is three d...

Vue implements image drag and drop function

This article example shares the specific code of ...

MySQL 4 methods to import data

1. Import mysql command The mysql command import ...

Angular Cookie read and write operation code

Angular Cookie read and write operations, the cod...

How to upload the jar package to nexus via the web page

When using Maven to manage projects, how to uploa...

A super detailed Vue-Router step-by-step tutorial

Table of contents 1. router-view 2. router-link 3...

Introduction to new ECMAscript object features

Table of contents 1. Object properties 1.1 Attrib...