简体   繁体   English

如何在Firefox for Android中检测Android的版本号?

[英]How to detect Android's version number in Firefox for Android?

For a website we want to show a link in the play store if the user comes with an Android 4+ device. 对于网站,如果用户附带Android 4+设备,我们希望在Play商店中显示链接。 All browsers we tested sent the version number of Android in their user-agent string, except one: Firefox for Android. 我们测试的所有浏览器都在其用户代理字符串中发送了Android的版本号,除了一个:Firefox for Android。 Firefox just sends this: Firefox只是发送这个:

Mozilla/5.0 (Android; Mobile; rv:19.0) Gecko/19.0 Firefox/19.0

and even with some JavaScript I can't find any evidence for the version number: 甚至使用一些JavaScript我找不到版本号的任何证据:

<script language="JavaScript">
  document.write(navigator.appVersion + "\n<br/>OS CPU: " + navigator.oscpu);
</script>

returns: 收益:

5.0 (Android)
OS CPU: Linux arm7l

Did I miss some other methods? 我错过了其他一些方法吗?

Unfortunately, you cannot. 不幸的是,你做不到。 See Bug 625238 - Add device info to User-Agent and the related Bug 807495 - User Agent does not include handset Device Model . 请参阅错误625238 - 将设备信息添加到User-Agent和相关的Bug 807495 - 用户代理不包括手机设备型号

In general, Mozilla has a policy of not adding User Agent (or HTTP header) information, and they currently have the opinion that developers do not need to know the running Android version. 一般来说,Mozilla的政策是不添加用户代理(或HTTP标头)信息,他们目前认为开发人员不需要知道正在运行的Android版本。

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

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