The most powerful browser sniffer in history

Source: Internet
Author: User

In front-end development often encounter a series of compatibility issues, how to accurately identify the version of each browser is a headache, especially navigator may be forged by the manufacturer. While the great gods recommend that you work with browser features rather than through browser versions, there are considerable difficulties in the actual operation.

Here are the various browser sniffing methods that the great gods have summed up.

IE article:

ie=!! Window. VBArray
ie678=!+ "\v1"; ie678=!-[1,];ie678= ' \v ' = = ' V '; ie678= (' A-B '. Split (/(~)/)) [1]==]ie678=0.9.tofixed (0) = = "0"ie678=/\w/.test (' \u0130 ') IE8=WINDOW.TOSTATICHTMLIE9=window.msperformanceie678=0//@cc_on +1;ie67=! " 1 "[0] IE8=!!window. XDOMAINREQUEST;IE9=document.documentmode&&document.documentmode===9; Ie10=Window.navigator.mspointerenabled;ie11= !! Window. Msinputmethodcontext;

Firefox article:

Firefox=!!window.netscape;
firefox=!! Window.updatecommands;
safari=window.opendatabase&&!window.chrome;
chrome=!! (Window.chrome&&window.google);

Mobile device article:

Iphone=/iphone/i.test (navigator.useragent);
iphone4=window.devicepixelratio>=2;
Ipad=/ipad/i.test (navigator.useragent);
Android=/android/i.test (navigator.useragent);
ios=iphone| | ipad

The most powerful browser sniffer in history

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.