Ways to identify your browser's JavaScript engine

Source: Internet
Author: User

Answer from StackOverflow, open this page Http://jsbin.com/opuvas can, this page is also the answer person wrote.

QR code is this URL. The website has the statistic visit quantity, the author wants to know to how many people is useful, the suggestion respects the original, does not copy this webpage.

Available for both PC browser and mobile browser.

The principle is this JS:

1Window.onload =function() {2     varv8string = ' function%20javaenabled%28%29%20%7b%20%5bnative%20code%5d%20%7d ';3 4     if(Window.devicepixelratio)//If WebKit Browser5     {6         if(Escape (navigator.javaEnabled.toString ()) = = =v8string) {7Display (' V8 detected ');8}Else {9Display (' JSC detected ');Ten         } One}Else { ADisplay ("Not a WebKit browser"); -     } -  the     functionDisplay (msg) { -         varp = document.createelement (' P '); -p.innerhtml =msg; - Document.body.appendChild (p); +     } -  +};

First, it detects the attribute Devicepixelratio peculiar to WebKit, and then detects the implementation of V8-specific javaenabled function.

Transferred from: http://blog.csdn.net/hursing/article/details/12868955

Ways to identify your browser's JavaScript engine

Related Article

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.