window.navigator.userAgent真的会被弃用吗? [英] Is window.navigator.userAgent really going to be deprecated?

查看:285
本文介绍了window.navigator.userAgent真的会被弃用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在MDN上阅读有关窗口的信息。 navigator.userAgent:

I just read on MDN about window.navigator.userAgent:


已弃用
此功能已从Web标准中删除。
虽然有些浏览器可能仍然支持它,但它正在被丢弃
。不要在旧项目或新项目中使用它。使用它的页面或网络应用
可能随时中断。

Deprecated 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.

我在网上找不到任何其他重要参考确认此声明。用户代理信息由于各种原因(分析,特定浏览器中的错误修复......)被许多公司广泛使用。虽然我明白人们应该使用特征检测而不是嗅探它,但这些信息会消失似乎令人难以置信。

I am not finding any other significant reference on the web confirming this statement. User agent information are widely used by many companies for various reasons (analytics, bug fixes in specific browser ...). While I understand that one should use feature detection over ua sniffing it just seems incredible that this information would go away.

它真的消失了还是仅仅是一个Mozilla的东西?

Is it really going away or is it just a Mozilla thing?

如果有,是否有替代品?

If so, is there a replacement for it?

推荐答案

现在,弃用通知似乎已经消失。它已被昨天删除在第一次提出此问题后一年,评论如下:

The deprecation notice seems to be gone now. It was removed yesterday, over a year after this question was first asked, with the following comment:


rm弃用率标记。这不会从生活规范中删除,也不会弃用。出于质量原因,大多数用例都是不受欢迎的,但这是其他用途。

rm deprecation marker. This is not removed from the living spec and no deprecation either. Most use cases are discouraged for quality reasons, but that's something else.

WHATWG生活标准没有弃用此属性,因此确认属性不是走开了。当然,这是一个废话,容易欺骗,但不推荐使用与弃用不同。正如您所注意到的,太多的作者和组织依赖于此属性,因为它只是简单地被推测出来并从实现中删除。

The WHATWG Living standard hasn't deprecated this property, so that confirms that the property isn't going away. Sure, it's a crapshoot and easily spoofed, but "not recommended for use" is not the same as "deprecated". As you note, too many authors and organizations depend on this property for it to be simply specced out of existence and removed from implementations.

也许对这个词的含义感到困惑弃用是首先导致弃用通知的原因。顺便说一句,文章本身仍然被错误地标记为已弃用。

Perhaps confusion over the meaning of the word "deprecated" is what resulted in the deprecation notice in the first place. The article itself is still incorrectly tagged "Deprecated", by the way.

请注意,Mozilla不对MDN文档的贡献负责。社区是。与任何其他社区策划的非官方知识库(包括本网站)一样,不要将其信息视为福音,总是交叉引用等(正如您在此处所做的那样)。

Note that Mozilla is not responsible for contributions to the MDN docs. The community is. And as with any other community-curated, unofficial knowledge base (including this very site), don't treat its information as gospel, always cross-reference, etc (as you have done here).

这篇关于window.navigator.userAgent真的会被弃用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆