Skip to content
Advertisement

Getting a browser’s name client-side

Is there any object or method that returns data about the browser, client-side?

For example, I need to detect if the browser is IE (Interner Explorer). Following is the code snippet.

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

Is there a better way?

Advertisement

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…

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement