简体   繁体   中英

How to identify the OS name and version in Client machine using java?

<% 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?

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.

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

您可以在HTTP标头中获得一些信息,例如User-Agent。

如果可以使用javascript,则可以简单地找到navigator.appVersion并使用它来确定操作系统,例如appVersions是否为Windows 5.0,这意味着系统正在使用Windows XP。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM