Identification of the browser's JavaScript Engine _ javascript tips-js tutorial

Source: Internet
Author: User
The method for identifying the browser's JavaScript Engine is available for both PC and mobile browsers. In fact, the implementation principle is the following JavaScript code. If you are interested, you can refer to the answer from StackOverflow to open this webpage.

The QR code is the URL. The webpage contains statistics on the access volume. The author wants to know how many people are useful. We recommend that you respect originality and do not copy this webpage.


Available for both PC and mobile browsers.

The principle is this section of js:

The Code is as follows:


Window. onload = function (){
Var v8string = 'function % 20 javaEnabled % 28% 29% 20% 7B % 20% 5 Bnative % 20 code % 5D % 20% 7D ';

If (window. devicePixelRatio) // If WebKit browser
{
If (escape (navigator. javaEnabled. toString () === v8string)
{
Display ('v8 detected ');
}
Else
{
Display ('jsc detected ');
}
}
Else {
Display ("Not a WebKit browser ");
}

Function display (msg ){
Var p = document. createElement ('P ');
P. innerHTML = msg;
Document. body. appendChild (p );
}

};


First, check the devicePixelRatio attribute that is unique to WebKit, and then check the implementation of the javaEnabled function that is unique to v8.
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.