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

好久不见. 提交于 2019-12-21 02:20:26

问题


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

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>

returns:

5.0 (Android)
OS CPU: Linux arm7l

Did I miss some other methods?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/15337026/how-to-detect-androids-version-number-in-firefox-for-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!