开发者

Detect IE8 64bit in Javascript

开发者 https://www.devze.com 2023-02-10 21:57 出处:网络
Hey there, I just wondered if there is a method to detect if the 64bit or 32bit Version of IE8 is running?

Hey there, I just wondered if there is a method to detect if the 64bit or 32bit Version of IE8 is running?

Because there are some m开发者_StackOverflowajor Bugs in the Facebook Javascript SDK which only occure in IE8x64...


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.”


The User Agent string for a 64-bit IE browser will indicate that it's 'x64' or 'Win64' if it's a 64-bit browser.

http://blogs.msdn.com/b/ie/archive/2009/01/09/the-internet-explorer-8-user-agent-string-updated-edition.aspx

A 64-bit IE8 user agent string:

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

vs. a 32-bit

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


For 64-bit IE on 64-bit Windows window.navigator.platform will be "Win64" and window.navigator.cpuClass will be "x64".

For 32-bit IE on 64-bit Windows window.navigator.platform will be "Win32" and window.navigator.cpuClass will be "x86".

For 32-bit Windows (which therefore must be running 32-bit IE), window.navigator.platform will be "Win32" and window.navigator.cpuClass will be undefined (I think).

-

Source: I made an app that uses JavaScript to determine if someone is using a 32 bit or 64 bit processor. You can see the code here on GitHub.


I'm not sure if you'll be able to detect 32bit/64bit, but this jquery plugin looks promising.

See http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/

0

精彩评论

暂无评论...
验证码 换一张
取 消