Dave's Brain

Browse - Programming Tips - How can I detect which browser the user is using?

Date: 2010jul22
Language: javaScript
Platform: web
Keywords: agent

Q.  How can I detect which browser the user is using?

A.  Access navigator.userAgent like this:

function isIE() { return navigator.userAgent.indexOf('MSIE') >= 0; } function isFirefox() { return navigator.userAgent.indexOf('Firefox') >= 0; }
You can also detect features.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.