Detect 64-Bit or 32-Bit Windows from User Agent or JavaScript

x64 or x32 with javascript?

The browser sends a user agent string to the server in every request. It contains some information about the browser and the operating system.

Detect IE8 64bit in Javascript

According to this IEBlog post you should be able to read it from the browsers User-Agent string via navigator.userAgent:

Detecting 64-bit Internet Explorer

As machines with more than 4 gigabytes of RAM become more common, more and more users are running 64-bit versions of Windows. For compatibility with 3rd party add-ons, the 32-bit edition of Internet Explorer remains the default on 64-bit systems. However, in some cases it can be useful for websites to recognize when users are visiting using 64-bit systems—for instance, a site may want to know whether to offer a 64-bit executable download.

Tokens in the User-Agent string will enable you to determine whether or not the user is running a 64-bit version of Windows, and whether they are running the 64-bit edition of Internet Explorer.

64-bit IE on 64-bit Windows:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; Trident/4.0)

32-bit IE on 64-bit Windows:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0)

Incidentally, WOW64 stands for “Windows on Windows 64-bit.”

Detecting OS and 32 or 64 bit processor in Rails

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?

How to find the operating system details using JavaScript?

If you list all of window.navigator's properties using

console.log(navigator);

How do I determine if the browser is 64-bit or not?

Thanks to @RocketHazmat, I uncovered that 64-bit browser support was introduced with Silverlight 5. My app was using Silverlight 4. So I upgraded to 5 and now it works with the 64-bit browsers I've tested.

However, there's still one exception. Even Silverlight 5 won't run in the metro version of IE10 under Windows 8. Apparently this is by design as this is a specialized version of IE10 optimized for touch. That still doesn't explain it for me though. I think it's lame.

Of course this means that 64-bit browser detection isn't really a concern anymore. Microsoft just needs to add Silverlight support to this browser and then I'll be happy.

UPDATE

I found an interesting tidbit related to the metro/modern IE10 in Win8. You can instruct the browser that there are plugins on the page that require the "desktop" version of IE.

You just need to add this meta tag to your HTML...

<meta http-equiv="X-UA-Compatible" content="requiresActiveX=true" />

And that'll generate this prompt...

Sample Image

Detection of OS and version on page load afer matching the browser User Agent with the list of user agents for each version in JSON

You need to do is in this way :

var osPlatforms = [{  "name": "Windows",  "osVersions": [{    "name": "Windows 10 (32 bit)",    "osBit": "32",    "userAgent": ["Windows 10 (32 bit)", "win10", "Microsoft Windows 10", "Windows NT 10.0", "Microsoft Windows 10 (64-bit)", "Windows NT 6.1"],  }, {    "name": "Windows 10 (64 bit)",    "osBit": "64",    "userAgent": ["win10", "Microsoft Windows 10", "Windows NT 10.0", "Microsoft Windows 10 (32-bit)"],  }]}];
function matchTheOSVersionWithUserAgent(osVersion) { console.log(navigator.userAgent); var userAgentList = osVersion.userAgent; var matchRes; for (var i = 0; i < userAgentList.length; i++) { if (navigator.userAgent.match(userAgentList[i])) { matchRes = navigator.userAgent.match(userAgentList[i]); break; } } console.log(matchRes);}
matchTheOSVersionWithUserAgent(osPlatforms[0].osVersions[0]);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>


Related Topics



Leave a reply



Submit