One line of code solves various ie compatibility issues, including IE6, IE7, IE8, ie9, and ie10.

Source: Internet
Author: User
Tags website server

One rowCodeThis solution solves various Internet Explorer compatibility issues. In website development, Internet Explorer 6, Internet Explorer 7, Internet Explorer 8, Internet Explorer 9, and Internet Explorer 10 may not suffer from compatibility issues, in fact, Internet Explorer provides a solution. Google also provides a solution. Baidu also applies this solution to solve ie compatibility problems.Source codeAs follows <! Doctype...

One line of code solves various ie compatibility issues, including IE6, IE7, IE8, ie9, and ie10.

In website development, Google also provides a solution to compatibility issues because of compatibility issues.

Baidu also applied this solution to solve ie compatibility problems.

The source code of Baidu is as follows:

  1. <! Doctype HTML>
  2. <HtmlXmlns=Http://www.w3.org/1999/xhtmlXmlns: BD=Http://www.baidu.com/2010/xbdml>
  3. <Head>
  4. <MetaHTTP-equiv=Content-TypeContent="Text/html; charset = UTF-8 ″>
  5. <MetaHTTP-equiv=X-UA-compatibleContent=Ie = emulateie7>
  6. <Title>Baidu, you will know</Title>
  7. <SCRIPT>VaRWPO= {Start:NewDate*1,PID:109,Page:'Superpage'}</SCRIPT>

<Meta http-equiv = x-UA-compatible content = Ie = emulateie7>

You can open Baidu and right-click to view the source code! We can check whether such a line of code exists in the file header!

This sentence means to force the Internet Explorer 7 mode to parse the webpage code!

However, the same solution is also widely seen on some large e-commerce websites.

From the source code, we can see that

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 strict // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml" XML: lang = "en" lang = "en">  

Several ie usage modes are provided here!

    1. <MetaHTTP-equiv="X-UA-compatible"Content="Ie = 8 ″>

2. Google Chrome frame can also enable IE to use Chrome's engine:

    1. <MetaHTTP-equiv="X-UA-compatible"Content="Chrome = 1 ″/>

3. Force IE8 to use IE7 mode for parsing

    1. <MetaHTTP-equiv="X-UA-compatible"Content="IE = emulateie7 ″><! -IE7 mode->
    2. // Or
    3. <MetaHTTP-equiv="X-UA-compatible"Content="IE = 7 ″><! -IE7 mode->

4. Force IE8 to use IE6 or ie5 mode for parsing

    1. <MetaHTTP-equiv="X-UA-compatible"Content="Ie = 6 ″><! -IE6 mode->
    2. <MetaHTTP-equiv="X-UA-compatible"Content="Ie = 5 ″><! -Ie5 mode->

5. If a specific version of IE supports more than one compatibility mode, for example:

    1. <MetaHTTP-equiv="X-UA-compatible"Content="Ie = 5; Ie = 8 ″/>

2. Set the website server to specify the default compatibility mode

If the server is its own, you can define a custom header on the server to preset a specific file compatibility mode for their website. This specific method depends on your website server.

The following web. config file enables Microsoft Internet Information Services (IIS) to define a custom header to automatically compile all web pages using IE7 mode.

There are also other solutions, such as Google's

IE7-JS is a javascript library that resolves conflicts between IE and W3C standards. This makes Microsoft Internet Explorer behave like a web-compatible browser, supports more W3C standards and css2 and css3 selectors. It fixes many HTML and CSS problems and makes transparent PNG correctly displayed under ie5 and IE6.

Make ie5 and IE6 compatible to IE7 mode (recommended)

    1. <! -[If lt IE 7]>
    2. <SCRIPT src = "http://ie7-js.googlecode.com/svn/version/2.0 (Beta)/ie7.js" type = "text/JavaScript"> </SCRIPT>
    3. <! [Endif]->

Make ie5, IE6, and IE7 compatible with IE8 Mode

    1. <! -[If lt IE 8]>
    2. <SCRIPT src = "http://ie7-js.googlecode.com/svn/version/2.0 (Beta)/ie8.js" type = "text/JavaScript"> </SCRIPT>
    3. <! [Endif]->

Make ie5, IE6, IE7, and IE8 compatible to ie9 Mode

    1. <! -[If lt ie 9]>
    2. <SCRIPT src = "http://ie7-js.googlecode.com/svn/version/2.1 (beta4)/ie9.js"> </SCRIPT>
    3. <! [Endif]->

Solve PNG display problems

You only need to name the transparent PNG image as * -trans.png

Note that this method does not work for background-repeat and background-position. By default, the entire container is fully occupied.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.