5

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?

Jens Kohl
  • 5,899
  • 11
  • 48
  • 77
  • **See**: http://stackoverflow.com/questions/7184573/pick-up-the-android-version-in-the-browser-by-javascript –  Mar 11 '13 at 11:08
  • 1
    navigator.userAgent.indexOf('Android') should return the version – AnhSirk Dasarp Mar 11 '13 at 11:44
  • 1
    I didn't test that, but if this is true, you can report to mozilla. However, I don't think it is very wise to show different page to different version of Android platform. – StarPinkER Mar 11 '13 at 11:47
  • First two posters: That's the point, firefox does not report the version in the user agent. So your solution does not work. @JermaineXu In this case it makes sense, since the app on the play store has Android 4 as its requirement. – Jens Kohl Mar 11 '13 at 13:42
  • 1
    I understand that, but I think a warning is enough. You can show the link to all the users and tell them Android 4 required. – StarPinkER Mar 11 '13 at 13:46

1 Answers1

3

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.

Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193