Home >Web Front-end >HTML Tutorial >How to get browser type and version number with jQuery
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); });
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"); }
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!