Home  >  Article  >  Solve various IE (IE6-IE10) compatibility issues with one line of code

Solve various IE (IE6-IE10) compatibility issues with one line of code

小云云
小云云Original
2017-12-11 10:37:291923browse

This article mainly introduces how to solve various IE compatibility issues (IE6-IE10) with one line of code. It is a very good method and I hope it can help everyone.

x-ua-compatible is used to specify the model for IE browser to parse and compile the page

x-ua-compatible The header tag is not case-sensitive and must be used in the head, except the title Used before other meta.

1. Use one line of code to specify the browser to use a specific document mode.

<meta http-equiv="x-ua-compatible" content="IE=9" >
<meta http-equiv="x-ua-compatible" content="IE=8" >
<meta http-equiv="x-ua-compatible" content="IE=7" >

2. In some cases, we need to limit the browser’s parsing of the document to a specific version, or restrict the browser’s parsing of the document to a specific version. The processor is limited to the performance of some older versions. You can use the following method:

<meta http-equiv="x-ua-compatible" content="IE=EmulateIE9" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE8" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE7" >

Using this writing method, the browser will either use the standard mode for parsing, or use the IE5 Quirks mode for parsing.

3. For testing, we can also use the following statement to specify that the browser parses the page according to the highest standard mode.

<meta http-equiv="x-ua-compatible" content="IE=edge" >

4. Specification of multiple modes. We can separate multiple versions with commas. In this case, the browser will choose the highest version it supports from this list to render in standards mode. As in the example below, when browsing in IE8, the standards mode of IE7 will be used for rendering, because it does not support IE9 and IE10.

<meta http-equiv="x-ua-compatible" content="IE=7,9,10" >


Related recommendations:

How to resolve the compatibility issues regarding transparency in IE 6, 7, and 8

Solving js Date() date function browser compatibility issues

Sharing some ways to write IE browser compatibility issues

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn