Viral Shah Viral Shah - 5 months ago 59
Javascript Question

How to get browser's name client side?

Is there any object/method that will give me information on the browser, client side?

For example, I need to detect IE browser. I am using:

function st_IsIE()
{
if(navigator.appName.indexOf("Microsoft Internet Explorer") != -1)
{
return true;
}
return false;
}


Is there a better way?

Answer

EDIT: Since the answer is not valid with newer versions of jquery As jQuery.browser is deprecated in ver 1.9, So Use Jquery Migrate Plugin for that matter.


Original Answer

jQuery.browser

jQuery.browser and jQuery.browser.version

is your way to go...