Detect 32/64-bit platform using JavaScript (Failed!)
/* Why? */
I wanted to detect the platform which visitors use 32-bit or 64-bit using JavaScript on various browsers, for dynamically changing download URL of the new TortoiseHg 1.0 installers. Unfortunately, I couldn’t achieve that goal, but I’d like to put my result for future reference.
/* Environment */
First of all, I should describe the environment:
- Windows 7 Professional Japanese (64-bit)
- Intel Core2Duo E6850
/* Results */
Disclaimer: The data at this page are provided “as-is” without warranty.
Firefox 3.6 (32-bit)
| Property | Value |
| navigator.userAgent | Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2) Gecko/20100115 Firefox/3.6 |
| navigator.appCodeName | Mozilla |
| navigator.appName | Netscape |
| navigator.appVersion | 5.0 (Windows; ja) |
| navigator.platform | Win32 |
| navigator.vendor | (None) |
| navigator.vendorSub | (None) |
Firefox 3.7 alpha 1 (64-bit)
| Property | Value |
| navigator.userAgent | Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a1pre) Gecko/20100121 Minefield/3.7a1pre |
| navigator.appCodeName | Mozilla |
| navigator.appName | Netscape |
| navigator.appVersion | 5.0 (Windows; en-US) |
| navigator.platform | Win64 |
| navigator.vendor | (None) |
| navigator.vendorSub | (None) |
Internet Explorer 8 (32-bit)
| Property | Value |
| navigator.userAgent | Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; Creative AutoUpdate v1.40.01) |
| navigator.appCodeName | Mozilla |
| navigator.appName | Microsoft Internet Explorer |
| navigator.appVersion | 4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; Creative AutoUpdate v1.40.01) |
| navigator.platform | Win32 |
| navigator.vendor | (None) |
| navigator.vendorSub | (None) |
Internet Explorer 8 (64-bit)
| Property | Value |
| navigator.userAgent | Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; Creative AutoUpdate v1.40.01) |
| navigator.appCodeName | Mozilla |
| navigator.appName | Microsoft Internet Explorer |
| navigator.appVersion | 4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; Creative AutoUpdate v1.40.01) |
| navigator.platform | Win64 |
| navigator.vendor | (None) |
| navigator.vendorSub | (None) |
Google Chrome 4.0.249.89
| Property | Value |
| navigator.userAgent | Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5 |
| navigator.appCodeName | Mozilla |
| navigator.appName | Netscape |
| navigator.appVersion | 5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5 |
| navigator.platform | Win32 |
| navigator.vendor | Google Inc. |
| navigator.vendorSub | (None) |
Opera 10.10
| Property | Value |
| navigator.userAgent | Opera/9.80 (Windows NT 6.1; U; ja) Presto/2.2.15 Version/10.10 |
| navigator.appCodeName | Mozilla |
| navigator.appName | Opera |
| navigator.appVersion | 9.80 (Windows NT 6.1; U; ja) |
| navigator.platform | Win32 |
| navigator.vendor | (None) |
| navigator.vendorSub | (None) |
/* Conclusion */
Impossible to detect which 32-bit or 64-bit platform even if you’re using 64-bit Windows, except Internet Explorer.
So finally, I have to put a hyperlink that points 64-bit version of TortoiseHg at the top page.
比さしぶり
ブラウザは便利なソフトウェアだけど
機能重視で安定性や確実性無視だから
CPUのタイプを調べるような当然あって然るべき機能が
なかったりするからシステム作るときは、結構綱渡りだよね
sartord
25 Feb 10 at 12:55
ですねー。ブラウザはますます進化の速度を早めていますし。
ただまぁ今回に限って言えばインストーラなので、最初っからインストーラに32ビットも64ビットも同梱して、インストール時に判定しろよ、って話かもしれませんがw
まだノウハウの蓄積は乏しいですが、WiXは面白そうですよ。
kuy
25 Feb 10 at 13:00