Best ie version check method, ie version check

Source: Internet
Author: User

Best ie version check method, ie version check

Prerequisites: real-time performance of NodeList

When nodelist is obtained using document. getElementsByTagName, document. forms, document. images, and other methods, the content in nodelist will be updated in a timely manner.

We use it and the condition annotation to detect the oldIE version.

I think this is the most reliable method.

------------------------------ For the gorgeous split line, please let me know ------------------------------------

 

A major pain in front-end is to deal with various browsers. On this issue, the most awesome and most annoying is the Big Brother ie.


It's not for ie managers to eat white rice. ie is subject to operating system restrictions and cannot be upgraded at will. ie will never be able to "version Emperor"

However, ie9 will soon be faster. On win8.1, the ie startup speed is no less than chrome

"Browser capability detection is better than browser detection"

If (!! Document. addEventListener) // capability detection {alert ('I can add events through document. addEventListener ')}

Recognized by the industry.

But sometimes we still cannot avoid browser detection. Today, let's talk about ie's detection.

 

The following common detection methods are available:

Is there such a sentence in your code?

Var isIE6 = window. navigator. userAgent. indexOf ('ie 6')> 0; // O (partition _ parameters) O Haha ~

I think this method is the most cute.

Generally, he doesn't have any problems, but it looks very embarrassing (personal opinion)

In addition, we can change the "Change userAgent" attribute of "useragent"

2. Weird Detection

var isIE=!!window.ActiveXObject;
var isIE6=isIE&&!window.XMLHttpRequest;
var isIE8=isIE&&!!document.documentMode;
var isIE7=isIE&&!isIE6&&!isIE8;

Generally, we only support code like ie6 to be properly suspended in ie5.

3. Condition comments

varisIE6=false;

document.write("<!--[iflte IE6]><script>isIE6=true;</scr"+"ipt><![endif]-->");

if(isIE6){

alert('Your current browser is IE6 or below');

}

This method is stable but not elegant and writes dom elements.

 

 

The younger brother provides a method for your reference.

Click on the Code:

<! DOCTYPE html> 

 

Ps:

The ie4-9 uses condition comments to detect new dom elements that do not need to be inserted into the page

Ie10 does not support conditional annotations, but ie10 supports document. all.

For ie11, check it with ("ActiveXObject" in window ).

Do you have any questions? Welcome to discuss O (lead _ lead) O Haha ~


How to check the current IE version

C: \ Program Files \ Internet Explorer
For example, if the original IE program is placed in the C program file, right-click INTERNET. EXE, and you can see the attribute at the bottom, and click "version. You can see the attributes of your IE version.

Welcome to my blog: hi.baidu.com/sherrysn

How can I check the IE browser version?

Open IE and choose help> about. You can see it, or find the original IE program, right-click and select Properties to view the version.

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.