如何检测在Firefox Android的版本号为Android? [英] How to detect Android's version number in Firefox for Android?

查看:233
本文介绍了如何检测在Firefox Android的版本号为Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关我们要显示在Play商店的链接,如果用户配备了一个Android 4+设备的网站。所有的浏览器,我们测试发送的Andr​​oid版本号在他们的用户代理字符串,除1:火狐为Android。火狐只是发送这样的:

For a website we want to show a link in the play store if the user comes with an Android 4+ device. All browsers we tested sent the version number of Android in their user-agent string, except one: Firefox for Android. Firefox just sends this:

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

甚至与一些JavaScript,我找不到任何证据的版本号:

and even with some JavaScript I can't find any evidence for the version number:

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

收益:

5.0 (Android)
OS CPU: Linux arm7l

我错过了一些其他的方法?

Did I miss some other methods?

推荐答案

不幸的是,你不能。请参见错误625238 - 添加设备信息到用户代理和相关的错误807495 - 用户代理不包括手机设备型号

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.

在一般情况下,Mozilla有不添加用户代理(或HTTP标头)信息的政策,他们目前认为,开发者不需要知道正在运行的Andr​​oid版本。

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.

这篇关于如何检测在Firefox Android的版本号为Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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