Dave's Brain

Browse - programming tips - javascript is firefox is ie

Date: 2010jul22
Language: javaScript

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.
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, 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.