Skip to content

Instantly share code, notes, and snippets.

@tiberiur
Last active April 13, 2016 11:57
Show Gist options
  • Save tiberiur/c26493f6f2fdb1674c17 to your computer and use it in GitHub Desktop.
Save tiberiur/c26493f6f2fdb1674c17 to your computer and use it in GitHub Desktop.
[JS] Get browser version using navigator object.
function getBrowserVersion()
{
var findIndex;
var browserVersion = 0;
var browser = getBrowserName();
browserVersion = navigator.userAgent;
findIndex = browserVersion.indexOf(browser) + browser.length + 1;
browserVersion = parseFloat(browserVersion.substring(findIndex, findIndex + 3));
return browserVersion;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment