Notable moments in Firefox for Android UA string history

19 Sep 2018

Back by popular demand*, here's a follow-up to my blog post on Firefox Desktop UA string changes.

(*actual demand for this blog post asymptotically approaches zero the further you read)

Early versions of Firefox for Android used a Linux desktop UA string with a Fennec/<fennecversion> product token appended to the end.

Since version 41, Firefox for Android has (generally) followed the following UA string format:

Mozilla/5.0 (Android <androidversion>; <devicecompat>; rv: <geckoversion>) Gecko/<geckoversion> Firefox/<firefoxversion>

Gecko Version Sample Firefox for Android UA string
4 Mozilla/5.0 (Android; Linux armv7l; rv:2.1.1) Gecko/20110415 Firefox/4.0.2pre Fennec/4.0.1
11 Mozilla/5.0 (Android; Tablet1; rv:11.0) Gecko/11.0 Firefox/11.0 Fennec/11.0
11 Mozilla/5.0 (Android; Tablet; rv:11.0) Gecko/11.0 Firefox/11.02
41 Mozilla/5.0 (Android 4.4.43; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0
46 Mozilla/5.0 (Android 4.4.4; Mobile; CoolDevice4; rv:46.0) Gecko/46.0 Firefox/46.0
46 Mozilla/5.0 (Android 4.4.4; Mobile; Custom CoolDevice/ABCDEFG5; rv:46.0) Gecko/46.0 Firefox/46.0

Footnotes: 1. Version 11 added the notion of a <devicecompat> token to distinguish between Tablet and Mobile.

2. Version 11 also dropped the Fennec/<version> token for Native UI (non-XUL) builds.

3. For versions running on Android older than KitKat (v4), the Android version number is set to 4.41 to avoid UA sniffing assumptions tied to the Android platform capabilities. 4. Version 46 also added the ability to add the Android device name, controlled by the pref general.useragent.use_device. This is probably not widely used, if at all.

5. Version 46 added the ability to add a custom device string, with optional device ID, controlled by the pref general.useragent.device_string. This is also probably not widely used, if at all.

Footnotes to the Footnotes: 1. If I had to write this patch again, I would choose an obviously non-real 4.4.99, so it would be sniffable as a spoofed value. Yes, I am familiar with the concept of irony.