0

Sorry if this seems like a simple question but to me it isn't! I am still pretty new to Ruby and Rails so please bear with me.

On a webpage, I am trying to make a customized download link depending on the OS of the person accessing the website and I was wondering if it is possible to determine if the person is running a 32 or 64 bit processor. Is this included in the user agent somewhere and I am just too daft to see it? Or if there is a gem out there that does this for me and I just don't know about it please let me know.

Thanks in advance for any help.

Cheers, Sean

Chris Ledet
  • 11,458
  • 7
  • 39
  • 47
Sean
  • 2,891
  • 3
  • 29
  • 39
  • Duplicate of http://stackoverflow.com/questions/647969/detect-exact-os-version-from-browser – Jim Mitchener Jul 30 '11 at 21:40
  • I don't think it is a duplicate, I actually read that question first. I know how to get the OS of the incoming request, I just can't figure out if it is possible to determine if it is a 32 or 64 bit processor or if that is possible. – Sean Jul 30 '11 at 21:47
  • Unless you are saying that the answer there is inclusive of what I am asking and it is impossible for me as well. – Sean Jul 30 '11 at 21:48

1 Answers1

2

You can not make a 100% decision 100% of the time from just looking at the headers, but some of the time you can use the headers. Here's what Microsoft says about User Agent strings:

Understanding User-Agent Strings:
http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx

You can also run Javascript on the user's browser and post back the result to the server for more accurate results. See here for a discussion on this same topic:

Detect 64-bit or 32-bit Windows from User Agent or Javascript?

Community
  • 1
  • 1
Casper
  • 33,403
  • 4
  • 84
  • 79
  • I can confirm that `window.navigator.cpuClass` gives `undefined` but window.navigator.platform` gives `MacIntel`. Still do not think it can be done. – Chris Ledet Jul 30 '11 at 21:47
  • Yup..agree..it sounds good on paper, but there's probably no fool proof solution to this (yeah..make your installer multi-platform instead and detect CPU there instead, but that's a totally different approach :)). – Casper Jul 30 '11 at 21:51
  • Okay! Thanks so much for letting me know! I will just offer a 32 and 64 bit download button for Linux/OSX/Windows and let the downloader decide. I really appreciate the quick responses. – Sean Jul 30 '11 at 21:54