1

What built-in Javascript/jQuery methods are there to detect what Chrome browser I'm currently using? The only method I know of currently is to type about:version in the URL but my Javascript is not able to simulate that command.

Kiwibeats
  • 39
  • 1
  • 5
  • 1
    Can I ask what is driving this? The answers below are correct, but generally I'd recommend not relying on the browser version, but rather on feature detection. – loganfsmyth Nov 19 '14 at 17:01
  • 1
    @loganfsmyth I'm trying to detect for Chrome 32+ if user is able to activate Windows 8 mode for a tablet. – Kiwibeats Nov 19 '14 at 17:04
  • Does this answer your question? [How to detect the installed Chrome version?](https://stackoverflow.com/questions/4900436/how-to-detect-the-installed-chrome-version) – Michael Freidgeim May 15 '21 at 11:34

5 Answers5

4

You're looking for navigator.userAgent.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
3

Try this:

var v = navigator.userAgent.match(/Chrome\/(\S+)/);
var res = v ? v[1] : 'Not a Chrome';
vp_arth
  • 14,461
  • 4
  • 37
  • 66
3

You need navigator.appVersion:

//var x = navigator.appVersion;

var x = '5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2754.0 Safari/537.36';
var y = x.split('Chrome/')[1];

if( typeof y != 'undefined' ){
  y = y.split(' ')[0];
  console.log(y);
}

will return the chrome version: 53.0.2754.0

user2677034
  • 624
  • 10
  • 20
2

I recommend navigator.appVersion. Related documentation can be found here.

Xenyal
  • 2,136
  • 2
  • 24
  • 51
1

To get Full version of Chrome, then Try this:

var v = navigator.userAgent.match(/Chrome\/(\S+)/);
console.log(v[0]);     // you will get: Chrome/58.0.3029.110

var r = v[0].split('/');
console.log(r[1]);          //you will get: 58.0.3029.110
Vishal Thakur
  • 1,564
  • 16
  • 25