需要用javascript检查cpu的32位或64位架构
我有一个包含 javascript 的脚本,我必须检查 CPU 架构是 32 位还是 64 位。我无法使用 IE 来检查这个,因为所有机器上都安装了 32 位版本。当检测到架构时,它应该说您有 64 位处理器或 32 位处理器。我有哪些选择?
I have a script which contains javascript and I have to check if the CPU architecture is 32bit or 64bit. I can't use IE to check the this because on all machines is the 32bit version installed. When the architecture is detected it should say you have an 64 Bit processor or 32 bit processor. Which options do I have?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
navigator.userAgent 将主要包含架构。我不在 IE 上,所以无法帮助您
navigator.userAgent will mostly contain the architecture. I am not on IE so can't help you there
如果您正在开发 Chrome 扩展程序(或打包应用),那么您可以使用
chrome.runtime.getPlatformInfo
获取包含大量系统的对象信息并且从该对象中获取架构作为其成员,但看起来您不是在构建 Chrome 扩展或打包应用程序,而是在构建网站,我怀疑这在这里会有帮助。If you were developing a Chrome extension (or packaged app), then you could use
chrome.runtime.getPlatformInfo
to obtain an object containing a boatload of system information and, from that object, get the architecture as a member of it, but seeing as though you aren't building a Chrome extension or packaged app but a website, I doubt this would help here.没关系。硬件正在运行或正在模拟 32 位模式。所以从功能上来说,浏览器没有什么区别。
因此,有两件事可能会让您误入歧途:
- 您的 64 位架构机器从一开始就因 32 位操作系统而瘫痪
- 您的 64 位架构和 64 位操作系统正在运行 32 位浏览
器如果能够查看有多少观众被计算机制造商欺骗的数据,这将是一个有趣的指标。
我认为 JavaScript 路径让你完蛋了。
但是,如果您不反对获取 SSL 证书,您也许可以使用 Java 小程序。
http://docs.oracle.com/javase/tutorial/deployment/applet /security.html
It doesn't matter. The hardware is running or is emulating 32-bit mode. So functionally there is no difference to the browser.
So, two things can lead you astray:
-Your 64-bit architecture machine has been crippled from the get-go with a 32-bit OS
-Your 64-bit architecture with a 64-bit OS is running a 32-bit browser
It would be an interesting metric to be able to see the data about how many of your viewers got shafted by their computer manufacturer.
I think with the JavaScript path you are screwed.
However, if you are not opposed to getting a SSL certificate, you may be able to use a Java applet.
http://docs.oracle.com/javase/tutorial/deployment/applet/security.html