Detect if Chrome browser installation is 64-bit

4.4k views Asked by At

I am trying to perform a script that should run only on Chrome 64-bit version browsers. Is there a way to check using JavaScript if the Chrome version installed on a user's machine is 64-bit or 32-bit? t should be browser-specific, because for example I run a 64-bit OS and a 32-bit version of Chrome.

So far I managed to detect if the open browser is Chrome and what version of it using Bowser. But I am still struggling with the 64-bit browser detection.

3

There are 3 answers

1
A dev On

navigator.userAgent containes "WOW64" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36"

3
dakotaeggers3 On

Based on what I've found, you should try looking for the following strings

  • x86_64
  • x86-64
  • Win64
  • x64; (Mind the semicolon! Without it you will have false-positives.)
  • amd64
  • AMD64
  • WOW64
  • x64_64
3
Sarah Elan On

For extensive discussion of this question, see

The bottom line is that the property you are looking for is navigator.platform, which returns the platform of the browser, not the operating system.

You might also take a look at platform.js, a platform detection library.

EDIT

After looking into this further, it seems that while navigator.platform should reflect the browser platform, the actual value returned is not always useful.

For example, on Windows, both the 32-bit and 64-bit versions return "Win32". In that case, the user agent string has the better value of either WOW64 for the 32-bit browser or x64 for 64-bit.

Ultimately it seems like the better solution is to rely on canonical lists like in the linked questions, or use a library like platform.js.