I\'ve been searching around for code that would let me detect if the user visiting the website has Firefox 3 or 4. All I have found is code to detect the type of browser but
In pure Javascript you can do a RegExp match on the navigator.userAgent
to find the Firefox version:
var uMatch = navigator.userAgent.match(/Firefox\/(.*)$/),
ffVersion;
if (uMatch && uMatch.length > 1) {
ffVersion = uMatch[1];
}
ffVersion
will be undefined
if not a Firefox browser.
See working example →