Detailed analysis of JavaScript Client Detection Technology (1)

Source: Internet
Author: User

Detailed analysis of JavaScript Client Detection Technology (1)

1. Firefox

GeckoIs the rendering engine of firefox. The original Gecko was developed as part of the general Mozilla browser, and the first browser using the Gecko engine was Netscape6;

We can use the following JS Code to detect the situation:

var ua = navigator.userAgent;console.log(ua);

Print the following in firefox in windows:

Mozilla/5.0 (Windows NT 6.1; WOW64; rv: 38.0) Gecko/20100101 Firefox/38.0

These are some of the proxy strings written for Netscape6:

Mozilla/MozillaVersion Number (platform; encryption type; operating system or CPU; pre-release version; Gecko/Gecko version number; application or product/application or product version number );

2.Safari

The rendering engine of Safari isWebKitIt is a branch of the KHTML rendering engine of the Konqueror browser on the Linux platform. Several years later, webkit independently came out to become an open-source project, focusing on the development of the rendering engine;

The following code:

var ua = navigator.userAgent;console.log(ua);

Print the following in safari in windows:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2

Webkit user proxy strings are in the following format:

Mozilla/5.0 (platform; encryption type; operating system or cpu) AppleWebkit/AppleWebkit version number (KHTML, like Gecko) safari/safari version number;

3. Chrome

Google chrome usesWebkitAs the rendering engine, different javascript Engines are used;

The following JS Code:

var ua = navigator.userAgent;console.log(ua);

Print the following in chrome in windows:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36

The user agent string is completely self-Fetch webkit and only a section is added to indicate the chrome version number. The format is as follows:

Mozilla/5.0 (Platform; encryption type; operating system orCpu) AppleWebKit/AppleWebKitVersion Number(KHTML, like Gecko) chrome/chromeVersion NumberSafari/safariVersion Number

4.Opera

Opera's default user agent string is the most reasonable in all modern browsers-it correctly identifies its own extremely version number before Opera8.0; its user agent string adopts the following format:

Opera/Version Number(Operating system orCPU; Encryption type)[Language]

After Opera8 is released, the "language" part of the user proxy string is moved into parentheses to better match with other browsers, as shown below:

Opera/Version Number(Operating system orCPU; Encryption type; Language)

In the latest version opera29,

The following JS Code:

var ua = navigator.userAgent;console.log(ua);

Proxy Detection:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36 OPR/29.0.1795.60;


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.