Home > Web Front-end > HTML Tutorial > How to get browser type and version number with jQuery

How to get browser type and version number with jQuery

韦小宝
Release: 2017-11-29 09:40:23
Original
2265 people have browsed it

jQueryThe method of obtaining the browser type and version number is used on many occasions. You can take a look. jQueryIt can still be used if the basics are not good Come and learn jQuery knowledge!

Last code demonstration:

$(document).ready(function(){
varbrow=$.browser;
varbInfo="";
if(brow.msie){bInfo="MicrosoftInternetExplorer"+brow.version;}
if(brow.mozilla){bInfo="MozillaFirefox"+brow.version;}
if(brow.safari){bInfo="AppleSafari"+brow.version;}
if(brow.opera){bInfo="Opera"+brow.version;}
alert(bInfo);
});
Copy after login


jQuery Starting from version 1.9, $.browser and $.browser.version have been removed , replaced by the $.support method. If you need to know about $.support, please refer to:

jQuery 1.9 uses $.support instead of the $.browser method

Or use js Method:

var browser = navigator.appName;
var b_version = navigator.appVersion;
var version = b_version.split(";");
var trim_Version = version[1].replace(/[ ]/g, "");
if (browser == "Microsoft Internet Explorer" && trim_Version == "MSIE9.0") {
alert("IE9");
}
Copy after login

The above is how to use jQuery to get the browser type and version number. For more information, please go to PHP Chinese websitesearchOh~

Related recommendations:

##js/jquery gets the browser scroll bar height and Detailed explanation of width implementation usage

JQuery code to get the height of the content part of the browser window_jquery

jQuery gets the resolution in the browser Rate implementation code_jquery

The above is the detailed content of How to get browser type and version number with jQuery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template