14

Can I detect cpu type and speed, and/or amount of ram a computer has from a web page (javascript hopefully)?

1
  • 1
    Do you want those stats for the client computer, or the server? Commented Sep 28, 2010 at 23:40

7 Answers 7

8

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.

Sign up to request clarification or add additional context in comments.

Comments

6

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.

2 Comments

While hardwareConcurrency is a nifty HTML5 concept still in development, it's worth noting that userAgent can't be trusted to give all the information they're asking for. User agents are just arbitrary strings with no established format. While many modern browsers will include the OS, they are under no obligation to do so. You can also spoof a user agent easily with browser plugins. Some devices may report "Intel" or "x64" in the user agent, while others may not report architecture at all.
Yeah, but we can identify the platform using useragent and platform. On Windows/Linux system navigator.platform shows x64 or x32 and on Mac it shows MacIntel. Yes, hardwareConcurrency still under development and we can use it only on Chrome
5

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.

Comments

2

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.

5 Comments

@Allan - Flash is more adept to say run your own CPU benchmark, etc.
@Nick Craver - sorry I am not sure what you mean?
@Allan - If you're looking for capabilities, such as doing a speed test of CPU or even bandwidth is much more feasible in flash.
@Nick Craver - ok yes. What disadvantages is there of doing speed tests in JavaScript? Is it a less controllable environment?
@Allan - exactly, performance differs amongst JavaScript engines, it very widely varies, flash you can do a more accurate test in.
1

Nope, that's not possible. Unless you're going to ask the user, programmatically.

2 Comments

Asking the user to input the data isn't really "detecting" :)
Yep, that's why I said detecting is not possible. :)
1

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

1 Comment

On a 64 bit AMD system this still returns x86 so this is likely intended to only differentiate between ARM and x86 processing instructions likely implemented with Microsoft's attempt to move in to the mobile market and gather ARM versus x86 statistics. This will not even determine 32 versus 64 bit. Still, interesting.
0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.