!+ "\v1" is used to "determine browser type" or "IE Judge version" Problem!

Source: Internet
Author: User

This style of writing is to use the browser to the escape character "\v" different understanding of the browser type.
In IE, "\v" is not escaped, resulting in "V".
In other browsers, "\v" represents a vertical tab, so IE resolves "\v1" to "V1", while other browsers resolve to "\V1" to "1".

Add a "+" to the front to convert the following string into a number.
Because IE thinks "\v1" is "v1", so the preceding plus plus sign cannot be converted to a number, Nan
All other browsers can turn into 1.

The above is Baidu found the answer.

But the following I test the time unexpectedly appeared such a problem!

if (!+ "\v1") {     alert ("IE");} Else {     alert ("non ie");}

ie under (IE9):

Google under:

Under Firefox:

Is it not possible to pass this judgment now? Personally think so!

Change the IE mode to IE8 and get the result we want.

Can this now be judged by IE9 and IE8? - -

!+ "\v1" is used to "determine browser type" or "IE Judge version" Problem!

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.