JQUERY1.6 usage method four: detect browser_jquery
userAgent = navigator.userAgent,//User Agent is called user agent in Chinese, or UA for short. It is a special string header that enables the server to identify the operating system and version, CPU type, browser and version, and browser rendering used by the customer. Engine, browser language, browser plug-in, etc.
The following are the navigator.userAgent of each browser
//Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/533.21.1 (KHTML, like Gecko ) Version/5.0.5 Safari/533.21.1 --safari
//Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1 --chrome
//Opera/9.80 (Windows NT 5.1; U; Edition Next; zh-cn) Presto/2.8.158 Version/11.50 --opera
//Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; .NET4.0C; .NET4.0E; InfoPath.2) ---ie
//Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24 --firefox
//Regular for matching response browser representation
rwebkit = /(webkit)[ /]([w.] )/,//webkit
ropera = /(opera)( ?:.*version)?[ /]([w.] )/,//opera
rmsie = /(msie) ([w.] )/,//ie
rmozilla = /(mozilla) (?:.*? rv:([w.] ))?/,//mozilla
Through userAgent, we can see that chrome can be matched in the following way, but because Like safari, both have "safari". We can put it in front of rwebkit. to match
rchrome=/(Chrome)[ /]([w.] )/
Firefox can also do the same, put it in front of rmozilla for judgment
rfirefox=/(Firefox)[ /]([w.] )/
uaMatch : function(ua) {//Mainly the type and version of the browser obtained
ua = ua.toLowerCase();//The parameter is navigator.userAgent. Convert to lowercase. Of course, you can also declare case-insensitivity in the regular match (such as /(webkit)[ /]([w.] )/i)
var match = rwebkit.exec(ua) | |
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") [] ;//Since exec is used for matching, the returned result is an overall match and a submatch of the response, such as /(Chrome)[ /]([w.] )/, match will return Chrome/13.0.782.220, match[1 ] get chrome, match[2] get 13.0.782.220;
return { browser: match[1] || "", version: match[2] || "0" };
}
//uaMatch is a method in jQuery. Here, start calling and saving the browser model browser and version
browserMatch = jQuery.uaMatch( userAgent ); // Call uaMatch, and Return object return { browser: match[1] || "", version: match[2] || "0" };
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;//chromesafarioperamsiemozilla, for example, when we want to perform a specific operation under the opera browser, we can use $.browser.opera to determine whether it is the opera browser (true, false)
jQuery.browser.version = browserMatch.version;//Browser version
}
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;//Because safari uses AppleWebKit The engine, since Safari and Chrome both have it, are being processed separately
}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The steps to register an Ouyi account are as follows: 1. Prepare a valid email or mobile phone number and stabilize the network. 2. Visit Ouyi’s official website. 3. Enter the registration page. 4. Select email or mobile phone number to register and fill in the information. 5. Obtain and fill in the verification code. 6. Agree to the user agreement. 7. Complete registration and log in, carry out KYC and set up security measures.

The Ouyi Exchange app supports downloading of Apple mobile phones, visit the official website, click the "Apple Mobile" option, obtain and install it in the App Store, register or log in to conduct cryptocurrency trading.

To safely download the Binance APP, you need to go through the official channels: 1. Visit the Binance official website, 2. Find and click the APP download portal, 3. Choose to scan the QR code, app store, or directly download the APK file to download to ensure that the link and developer information are authentic, and enable two-factor verification to protect the security of the account.

Sesame Open Door is a platform that focuses on cryptocurrency trading. Users can obtain portals through official websites or social media to ensure that the authenticity of SSL certificates and website content is verified during access.

Choose a reliable trading platform such as OKEx to ensure access to the official entrance.

Registering a Sesame Door Account requires 7 steps: 1. Prepare a valid email or mobile phone number and a stable network; 2. Visit the official website; 3. Enter the registration page; 4. Select and fill in the registration method; 5. Obtain and fill in the verification code; 6. Agree to the user agreement; 7. Complete registration and log in, it is recommended to carry out KYC and set security measures.

EU MiCA compliance certification, covering 50 fiat currency channels, cold storage ratio 95%, and zero security incident records. The US SEC licensed platform has convenient direct purchase of fiat currency, a ratio of 98% cold storage, institutional-level liquidity, supports large-scale OTC and custom orders, and multi-level clearing protection.

Visit Binance official website and check HTTPS and green lock logos to avoid phishing websites, and official applications can also be accessed safely.
