0

I ran the below code in jsfiddle using chrome browser

console.log(navigator.appCodeName + ' - ' + navigator.appName + ' - ' + navigator.appVersion + ' - ' + navigator.userAgent + ' - ' + navigator.platform);

and got the below result

Mozilla - Netscape - 5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36 - Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36 - Win32

Things are fine except for

navigator.platform // this gave the output as Win32

whereas my OS is 64-bit. When it says platform, the 64 bit OS should indicated it as 64 bit only, but here its different. Can anyone explain ?

Thanks

µMax
  • 337
  • 1
  • 6
  • 15
  • 1
    Chrome is 32 bit. That may be part of the issue. – colecmc May 26 '15 at 03:05
  • @colecmc - that mean's navigator.platform returns the bit value of browser rather than OS, thanks so far i thought it's about OS – µMax May 26 '15 at 03:08
  • 1
    You can check if you have a 32 bit version of Chrome in the `chrome://chrome/` settings – colecmc May 26 '15 at 03:11
  • 3
    User agent strings are not controlled by any standard, they can be anything the authors want. You should not rely on information they provide (as you've discovered). There are [*databases*](https://www.google.com.au/search?rls=en&q=user+agent+string+database) that might narrow the odds. – RobG May 26 '15 at 03:14
  • 1
    `WOW64` in the user agent indicates 64-bit windows. – jfriend00 May 26 '15 at 03:15
  • @jfriend00 - it gives raise to another question - should we need to follow the agent navigator.appName to get the bit info of OS? kindly clarify – µMax May 26 '15 at 03:18
  • 1
    @colecmc hope your tried to type chrome://version/ - and it says mine is m(32-bit) – µMax May 26 '15 at 03:20
  • 2
    As far as I know, there is no specific standard for identifying 32-bit vs. 64-bit platforms from the user agent string, so if you were going to use that for it, you would just have to examine existing behaviors on the browsers you want to support and code for what they do. It begs the question of why you need to know? – jfriend00 May 26 '15 at 03:54
  • Seems like this might be a dup: [Detect 64-bit or 32-bit Windows from User Agent or Javascript?](http://stackoverflow.com/questions/1741933/detect-64-bit-or-32-bit-windows-from-user-agent-or-javascript) – jfriend00 May 26 '15 at 04:06

0 Answers0