Article Introduction: jquery detects browser name and version information. |
In jquery, you can get information about your browser by accessing the properties of the $.browser object. The $.browser object is the Jquery.browser object that handles browser-related transactions, and the properties of the object are as follows:
Property name |
Description |
Webkit |
True if the browser is WebKit related, False otherwise |
Mozilla |
True if it is a Mozilla-related browser, False otherwise |
Safari |
True if the Safari browser is False |
Opera |
True if the browser is Operan, or false |
Msie |
True if it is IE browser, false otherwise |
Version |
Get the version number of the browser |
The following is an example of viewing browser-related information:
<div id= "Tip" ></div>
<script>
$ (function () {
var browsertip = "Your browser name is:";
if ($.browser.msie) {//ie browser
browsertip + = "IE";
}
if ($.browser.mozilla) {//Firefox browser
Browsertip + + Mozilla Firefox;
}
Browsertip + = "version number is:" + $.browser.version; Gets the version number
$ ("#tip"). HTML (browsertip);
})
</script>