The Navigator object contains basic information about the Web browser (such as name, version, operating system, etc.)
You can refer to the object by Window.navigator and use its properties to read the client base information
5 Main properties of
Browser
First, detect the name of the browserProblem:The standard support for JavaScript is different for different browsers, and sometimes you want the script to work well on different browsers, and then you need to detect the browser, determine
Javascript| Browser
First, detect the name of the browserProblem:The standard support for JavaScript is different for different browsers, and sometimes you want the script to work well on different browsers, and then you need to detect the browser,
Javascript: use JavaScript to detect browser-related features. Javascript tutorial
I. Check the browser nameProblem:Different browsers have different standard support for javascript. Sometimes you want the script to run well on different browsers.
Detects browser versions, cores, systems, and whether to move the end
Copy Code code as follows:
/**
* Check Browser version
* @authors K
* @date 2014-04-11 14:48:39
* @version 1
*/
/*** Detect browser info with navigator
This article is an example of how JS determines the browser version and the browser kernel. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
if (!browser.ie &&!browser.mac) {
1. Check the features of the desktop browser.$. Checkdetect = function (){
VaR detect = {
IE:/MSIE \ s * \ D + \. \ D/GI,
Chrome:/chrome \/[\ W \.] + (\ s )? /GI,
Firefox:/Firefox \/[\ W \.] + (\ s )? /GI,
};
VaR UA = navigator. useragent.
if(!browser.ie &&!)Browser.mac) {varUA =navigator.userAgent.toLowerCase (). toString (); //determine if it is not a non-IE version under IE kernel if((Ua.indexof (' 360ee ') >-1) | | (Ua.indexof (' 360se ') >-1) | | (Ua.indexof (' SE ') >-1) | |
if (! browser.ie &&!browser.mac) {var UA = Navigator.userAgent.toLowerCase (). toString (); Determine if the IE kernel is not a non-IE version if (ua.indexof (' 360ee ') >-1) | | (Ua.indexof (' 360se ') >-1) | | (Ua.indexof (' SE ') >-1) | |
jquery implements the script code that detects the browser and version:In some specific scenarios, the application of progress bar effect, can improve the user-friendliness of the site, to enable users to master the progress, increase the patience
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.