In the past, the shortest IE determination was developed by virtue of the feature that IE does not support vertical tabs. Var ie =! + "\ V1 ";
Only 7 bytes! See this article, "32 bytes, ehr... 9, ehr... 7 !!! To know if your browser is IE, describes how foreigners reduce IE's judgment from 32 bytes to 7 bytes step by step! Story
But this record was broken by a Russian in January 8 this year, and now it only takes 6 bytes! It makes use of the difference between IE and the standard browser in handling the toString method of arrays. For the standard browser, if the last character in the array is a comma, The JS engine will automatically remove it. Congratulations, Aleko. You are my idol!
Var ie =! -[1,];
<Script type = "text/javascript"> var ie =! -[1,]; alert (ie); script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
If we judge from the Perspective of Non-IE, we can save a bit, because when we are compatible, most of the cases are IE and non-IE.
Var notIE =-[1,];
<Script type = "text/javascript"> if (-[1,]) {alert ("this is not an IE browser! ");} Else {alert (" this is IE browser! ");} Script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]