问题
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