I remember that one of the most frequently used methods of getting Down the source code on the internet is:
Copy codeThe Code is as follows: var ie = document. all ();
This is because the document of IE browser has the all method, but the so-called standard browser does not, so this is a very common method for a long time.
After that, everyone began to pursue brief content, just like a method that was once popular after that:
Copy codeThe Code is as follows: var ie =! + "\ V1 ";
This is determined by the use of IE that does not support the characteristics of vertical tabs. Only seven characters are already shocking, but this record was broken by a Russian earlier this year, it takes only 6 characters to complete.
We will not discuss what this character can do for the moment, but think of it as a research, or you can say that it is idle ~).
Copy codeThe Code is as follows: var ie =! -[1,];
In fact, its principle is very simple, [1,] in the standard browser will return the string "1", equivalent to calling [1,]. toString, IE will return "1 ,". However, in this way, both IE and standard pass detection. Therefore, the negative sign is forcibly converted to a number. if the standard is successfully converted to, it is automatically converted to true in if, while IE is converted to NaN, and then automatically convert to false! View the DEMO.
Simple, right? There will certainly be many people who are thinking the same as me. Why did I not think of it? Why did I not think of it? (Laugh ~)