views:

351

answers:

4

<% System.getProperty("os.name") %> can be used to identify the OS name running in the server machine. But how can i identify the OS information in the client machine using java in a web application?

A: 

You can have some information in HTTP headers, such as User-Agent.

Maurice Perry
User-Agent gives the OS name. But it does not give the specific name and version. For example, it will say 'Windows NT' even for Windows 2000 and Windows XP. But I want to identify the exact version.
Shwetha
+3  A: 

You can't. The browser doesn't send detailed OS information to web servers.

You can do some wild guess from the user-agent but that's not accurate at all.

ZZ Coder
yes they do you can see stat in Google Analytics it show alot of data of client and only by javascript code so this can be done
Rahul Garg
If you run software on client (including Javascript), it's a totally different issue. Some website can even fetch your computer serial number with ActiveX but I guess that's not the original question.
ZZ Coder
A: 

if you can use javascript you can simply find the navigator.appVersion and use it to determine the OS like if the appVersions is Windows 5.0, this means that the system is using Windows XP.

Saeros
System.getProperty("os.name") returns the server's os name
dfa
+2  A: 

You'd have to use javascript or other client-side technology to find out. Then, send it back to the server throuht http.

Tom