Reputation: 4983
Is there a way to detect Google Chrome's version from the console. I know I can parse the user agent string - but I prefer a more concise way.
Here is what I currently have:
var uaStr = navigator.userAgent.toLowerCase();
var index = uaStr.indexOf('chrome/');
uaStr.substring(index +7,index+11);
I would like to know if there's a better way - something like chrome.version()
Thanks.
Upvotes: 41
Views: 39398
Reputation: 1193
In Chrome DevTools Console execute the following statement:
> navigator.appVersion.match(/.*Chrome\/([0-9\.]+)/)[1]
And you will get the version number as a string
> "51.0.2704.103"
Upvotes: 80