![]() |
Question: How do I detect the browser version in JavaScript?
Answer:
Unfortunately, the value of parseInt(navigator.appVersion)
is no good for detecting the browser version.
In many JavaScript-aware browsers, the navigator.appVersion
string begins with
the number of compatible Netscape Navigator version rather than
the version of the user's actual browser.
(Even in the early days of JavaScript, Microsoft Internet Explorer 3 used to return
a navigator.appVersion
string that began with 2, which was intended to reflect
the compatibility with Netscape Navigator 2.)
Thus, to get the full version number of the browser,
you need to rely primarily on the navigator.userAgent
string,
just like in the Browser Name code example.
Here is your browser's name and version:
(Source code can be found in the Browser Name article.)
Copyright © 1999-2011, JavaScripter.net.