问题描述
我想知道为什么 navigator.userAgent , navigator.appName , navigator.appVersion 和 navigator这样的javascript操作系统检测技术。平台正在从Web标准中删除。
I was wondering why javascript os detection techniques like navigator.userAgent, navigator.appName, navigator.appVersion and navigator.platform are in process of being dropped from web standards.
如果您访问所有这些导航器道具,则可以看到
If you visit every of those navigator props, you can see
已弃用
此功能已从Web标准中删除。尽管某些浏览器可能仍支持它,但是它正在被删除。不要在新旧项目中使用它。
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
所以我想知道
- 为什么要删除它
- 他们会为操作系统检测引入新的方法吗?
- 即使他们
在很多情况下,我们需要了解操作系统版本。
Probably there is a lot of cases where we need to know OS version.
推荐答案
在MDN上,它被错误或意外地标记为已弃用。一旦发现问题,他们便迅速纠正了该页面,但是由于它是一个确定的信息源,因此在各处仍然存在对其不推荐使用的引用。
It was incorrectly or accidentally marked as deprecated on MDN. They quickly corrected the page once they saw the problem, but since it had been a definitive source, references to it being deprecated still exist here and there.
这里是固定的对话:
这篇关于不推荐使用的Javascript OS检测技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!