Method 1: A brief condition for vertical tab support features through IE and non ie browsers:
| The code is as follows |
Copy Code |
var ie =!+ "V1″; |
Method 2: The use of IE and the standard browser in the processing array of the ToString method of the difference made. For a standard browser, if the last character in the array identifier a comma, the JS engine automatically strips it.
| The code is as follows |
Copy Code |
| var ie =!-[1,]; |
Everyone can test:
| The code is as follows |
Copy Code |
var ie =!-[1,]; alert (IE); |
I tested it, the effect is good, recommend to you to see
| The code is as follows |
Copy Code |
if (!-[1,]) { Alert (' Is ie! ') }else{ Alert (' Non ie! ') } |
Whether the method is worthy of being popularized must be verified by many, but it is not yet the most effective method, but it can be used in many agile development needs.
Full instance
| The code is as follows |
Copy Code |
var isie=!! Window. ActiveXObject; var Isie6=isie&&!window. XMLHttpRequest; var isie8=isie&&!! Document.documentmode; var isie7=isie&&!isie6&&!isie8; if (Isie) { if (isIE6) { Alert ("Ie6″"); }else if (isIE8) { Alert ("Ie8″"); }else if (isIE7) { Alert ("Ie7″"); } } |
Then there is a slightly