JS Get IE version number and HTML to set IE Document mode _javascript tips

Source: Internet
Author: User

JavaScript gets the IE version code:

var GIE = Getie ();
      Alert (gie.version)
    function Getie () {
      var Rmsie =/(MSIE) ([\w.] +)/;
      var ua = Navigator.userAgent.toLowerCase ();
      var match = rmsie.exec (UA)
      var result = {};
      if (match && match.length > 0) {result
        = {Browser:match[1] | | "", Version:match[2] | | " 0 "}
      } return result
      ;
    }

If the compatibility mode error is compatible with the IE version, you can use the following code:

<meta http-equiv= "x-ua-compatible" content= "ie=9;ie=8"/> <meta http-equiv=

"x-ua-compatible" content= "ie=9,8"/> 

Specifies that the browser uses a specific document mode. Content has two ways of writing, which can be separated by ";" or "," and not in writing order, and the browser will select the highest version of the list that he supports to render using standard mode.

There is another way:

<meta http-equiv= "x-ua-compatible" content= "ie=edge,chrome=1"/> 

This can be achieved if the GCF is installed, then use GCF to render the page, if the GCF is not installed, then use the highest version of the IE kernel for rendering. Google Chrome frame (google embedded browser framework GCF). This plugin can make the user's IE browser unchanged, but the user browsing the web, the actual use of Google Chrome browser kernel, and support IE6, 7, 8 and many other versions of IE browser.

The above is small series for everyone to bring JS get IE version number and HTML set IE document mode of the content of the method, I hope that we support cloud Habitat Community ~

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.