JAVASCRIPT obtains the IE version number and sets the IE document mode in HTML.

Source: Internet
Author: User
JAVASCRIPT gets the IE version number and HTML sets the IE document mode 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 an error occurs in compatibility mode compatible with the IE version, use the following code:

 
 
 

Specifies that the browser uses a specific document mode. The content can be separated by a comma (;) or separated by comma (,). It has nothing to do with the order of writing, the browser selects the highest supported version from the list to use the standard mode for rendering.

Another method is as follows:

 

In this way, if GCF is installed, GCF is used to render the page. If GCF is not installed, the highest version of IE kernel is used for rendering. Google Chrome Frame (Google embedded browser framework GCF ). This plug-in can keep your IE browser unchanged. However, when you browse the Web page, you actually use the Google Chrome browser kernel and support multiple Internet Explorer versions such as IE6, 7, and 8.

Related Article

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.