简体   繁体   English

如何使用Java识别客户端计算机中的操作系统名称和版本?

[英]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. <%System.getProperty(“ os.name”)%>可用于标识在服务器计算机上运行的OS名称。 But how can i identify the OS information in the client machine using java in a web application? 但是,如何在Web应用程序中使用Java来识别客户端计算机中的OS信息?

You can't. 你不能 The browser doesn't send detailed OS information to web servers. 浏览器不会将详细的操作系统信息发送到Web服务器。

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. 您必须使用javascript或其他客户端技术才能找到答案。 Then, send it back to the server throuht http. 然后,通过http将其发送回服务器。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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