Can I detect cpu type and speed, and/or amount of ram a computer has from a web page (javascript hopefully)?
Can I detect cpu type and speed, and/or amount of ram a computer has from a web page (javascript hopefully)开发者_StackOverflow中文版?
No, that's not possible. There is no access to hardware information through JavaScript in web browsers. You might have some luck using browser plugins, ActiveX, etc.
The only thing with any knowledge of the system on which it's running is the Operating System. The Operating System creates an abstraction layer in which every application runs. Applications can't know what processor you have or how much RAM you have without asking the Operating System. No modern browser will ask.
The Java Virtual Machine does ask the Operating System, so you could do it with a Java applet.
Otherwise you'd need a browser plugin.
It is not possible to detect CPU type and speed. But you can find number of cores and CPU manufacturer information. You can figure out system performance based on number of CPU cores. Number of cores is directly proportional to performance. Higher core machine gives good performance.
navigator.hardwareConcurrency shows the number of CPU cores, but it works only on chrome.
navigator.hardwareConcurrency
navigator.userAgent gives the complete OS and browser information.
navigator.userAgent
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"
navigator.platform shows System info
navigator.platform
"MacIntel"
Hope this helps.
This info isn't available, at least not in a consistent or reliable way using only JavaScript...flash may be an option, but there are many security restrictions around that too, so I'm not sure what's available to it.
Nope, that's not possible. Unless you're going to ask the user, programmatically.
In IE you can detect the cpuClass. It doesn't tell you much, but maybe there is any use for you.
http://msdn.microsoft.com/en-us/library/ms533697%28v=VS.85%29.aspx
If your end goal is doing different actions based on the whether or not they'll render fast/correctly on the users comp, you could time certain keystone processes and run different processes based on the result.
精彩评论