简体   繁体   中英

Detecting OS and 32 or 64 bit processor in Rails

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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM