简体   繁体   English

如何使用 JavaScript 检测操作系统(不推荐使用 window.navigator)

[英]How to detect Operating System with JavaScript (without deprecated window.navigator)

Detecting the operating system of a visitor used to be easy with the navigator.platform solution.使用navigator.platform解决方案过去可以轻松检测访问者的操作系统。 However, this solution is now deprecated, so my question, quite simply, is there another way to retrieve the OS using JavaScript?但是,这个解决方案现在已被弃用,所以我的问题很简单,是否有另一种使用 JavaScript 检索操作系统的方法?

I have looked around the web and everything seems to point towards the navigator object, but as you can see from the following link, this has been deprecated...我环顾了网络,一切似乎都指向navigator对象,但正如您从以下链接中看到的那样,这已被弃用...

https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/platform https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/platform

This can be usefull for you, a small project from github.这对你很有用,来自 github 的一个小项目。

https://github.com/Pagawa/PgwBrowser http://pgwjs.com/pgwbrowser/ https://github.com/Pagawa/PgwBrowser http://pgwjs.com/pgwbrowser/

The code to use var pgwBrowser = $.pgwBrowser();使用代码var pgwBrowser = $.pgwBrowser();

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

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