How to detect Firefox, Chrome and Internet Explorer with JavaScript

First of all keep in mind that User Agents can be spoofed, so they could be lying to you. If you need to detect a feature (animations, opacity...) use something like Modernizr instead.

How to detect Firefox with JavaScript

How to detect Chrome with JavaScript

How to detect Internet Explorer with JavaScript

If you need to detect IE9 and below first add the following HTML to your header:

Then use this short jQuery snippet:

Sadly, in IE11 they changed how we can detect it. At the time of the writing I couldn't found a reliable way. Do you know one?

2 comments

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*