This question already has an answer here:
- How can you detect the version of a browser? 23 answers
How do I determine the exact browser and version using JavaScript?
This question already has an answer here:
How do I determine the exact browser and version using JavaScript?
If you want a function that returns the browser as well as the version, here is an improvement from the original answer:
With this, it also stores the result locally, so this check is not necessary to run every time.
you can more read How to detect Safari, Chrome, IE, Firefox and Opera browser?
This is something I wrote to get client info
I know I'm WAY late to this question, but figured I'd throw my snippets up here. A lot of the answers here are OK, and, as one points out, it's generally best to use
feature detection
rather than rely on theuserAgent
string. However, if you are going to go that route, I've written a complete snippet, as well as an alternate jQuery implementation to replace the depricated$.browser
.Vanilla JS
My first snippet simply adds four properties to the
navigator
object:browser
,version
,mobile
, &webkit
.jsFiddle
As the name implies, this will tell you the name and version number supplied by the browser.
It is handy for sorting test and error results, when you are testing new code on multiple browsers.
This tells you all the details about your browser and the version of it.