Detect Browsers using jQuery

How to get browser By jquery. webtechsource defines in simple words that easy to figure out. now you need to directly put the this code and check.

jQuery provides a property to detect the browser. It works well for IE, mozilla, Safari and opera browser but it doesn’t work for Google Chrome. Below jQuery code gives you an idea about $.browser property.

jQuery( document ).ready(function() { = /chrom(e|ium)/.test(navigator.userAgent.toLowerCase());
if( {
alert(1); // its for chorme
}else if (navigator.userAgent.match(/msie/i) || navigator.userAgent.match(/trident/i) ){
alert(4); // its for i.e
else if (jQuery.browser.mozilla) {
alert(2); // its for mozila


The jQuery browser property allows you to determine the browser in which the webpage is running. This property makes use of navigator.userAgent to determine the platform.

Well, if you have installed chrome on your machine and safari is not installed then you can use $.browser.safari to detect chrome. As both the browsers are fully based on webkit. webkit is one of the flag of $.browser property. It will be true for safari and chrome. But that’s not a proper way to detect chrome.

Need Browser Version

its very easy to understand if you faced any problem. put in comment we will more help to you for more information visit regulary to our knowledge base blog

I, Dayanand Saini,the founder and chief editor of,have been working as a software engineer from last 4+ years. It's my hobby to learn new things and implement on live environment.

Leave a Reply

Your email address will not be published. Required fields are marked *

15 + = 18

%d bloggers like this: