Fennec/User Agent: Difference between revisions

no edit summary
No edit summary
Line 1: Line 1:
This is a proposal for what the Firefox Mobile User Agent string should be. We expect it to be vigorously debated, but ask that people base their points on evidence :-)
This is a proposal for what the Firefox Mobile User Agent string should be, which has been endorsed by the Fennec team. It takes into account various newsgroup discussions, plus John Jensen's [https://docs.google.com/spreadsheet/ccc?key=0AushOZLFQoR0dGQ0Ry1HYmZGUEg5dXJDYUstS2dwcWc&hl=en_GB#gid=0 comparative analysis] of various potential User Agent strings. (See below for more info on how to correctly interpret that data.)


==Summary==
==Summary==
Line 5: Line 5:
Mobile:
Mobile:


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


Tablet (touch screen device):
Tablet (touch screen device):


   Mozilla/5.0 (Tablet; rv:12.0) Gecko/0 Firefox/12.0
   Mozilla/5.0 (Android; Tablet; rv:12.0) Gecko/12.0 Firefox/12.0


Netbook (or tablet with attached pointing device, e.g. in a dock):
Netbook (or tablet with attached pointing device, e.g. in a dock):


   Mozilla/5.0 (X11; rv:12.0) Gecko/0 Firefox/12.0   
   Mozilla/5.0 (Android; Desktop; rv:12.0) Gecko/12.0 Firefox/12.0   


(Examples are for Firefox 12; clearly, 12.0 would change for later versions.)
(Examples are for Firefox 12; clearly, 12.0 would change for later versions.)
Line 23: Line 23:
   Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10
   Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10


In addition, variance in the user agent string adds additional bits of entropy which can be used for [http://panopticlick.eff.org/ browser fingerprinting]. For this reason, we have done [https://wiki.mozilla.org/Fingerprinting work in Firefox 4 and beyond] to try and reduce UA string variance.
In addition, variance in the user agent string adds additional bits of entropy which can be used for [http://panopticlick.eff.org/ browser fingerprinting]. For this reason, we have done [https://wiki.mozilla.org/Fingerprinting work in Firefox 4 and beyond] to try and reduce UA string variance. The only variable bits are the version number, plus Mobile/Tablet/Desktop, plus the OS.


So our hope is to provide the shortest UA string possible, encourage good practice in sniffing, avoid giving developers footguns, and (as much as possible) avoid breaking existing working sites. It is not a goal to make sites which are currently broken to work - we don't think playing that game this way leads to a good outcome, and are committed to solving that problem through [[Mobile/Evangelism|evangelism]] and compatibility improvements to our platform. But <b>we want to and must nail down what the string should be, so we can start the work of evangelism without the risk of telling sites things which later turn out to become false.</b>
So our hope is to provide the shortest UA string possible, encourage good practice in sniffing, avoid giving developers footguns, and (as much as possible) avoid breaking existing working sites. It is not a goal to make sites which are currently broken to work - we don't think playing that game this way leads to a good outcome, and are committed to solving that problem through [[Mobile/Evangelism|evangelism]] and compatibility improvements to our platform. But <b>we want to and must nail down what the string should be, so we can start the work of evangelism without the risk of telling sites things which later turn out to become false.</b>
Line 35: Line 35:
===Platform===
===Platform===


We have put the "Mobile" and "Tablet" identifiers where the platform identifiers were because that's the logical place for them to go. Anyone sniffing for the string "Mobile" doesn't care where they are. Firefox is not going to match anyone sniffing for "Mobile Safari" wherever we put the word "Mobile" (and sometimes that string isn't present on WebKit anyway, as some Webkit UAs have "Mobile/&lt;ver> Safari"). Mobile Internet Explorer [http://blogs.msdn.com/b/iemobile/archive/2010/03/25/ladies-and-gentlemen-please-welcome-the-ie-mobile-user-agent-string.aspx uses "IEMobile"]. So really, just sniffing for "Mobile" is the way to find all these mobile browsers. (Although iPad also says "Mobile".)
We have put the "Mobile" and "Tablet" identifiers among the platform identifiers because that's the logical place for them to go. Anyone sniffing for the string "Mobile" doesn't care where they are. Firefox is not going to match anyone sniffing for "Mobile Safari" wherever we put the word "Mobile" (and sometimes that string isn't present on WebKit anyway, as some Webkit UAs have "Mobile/&lt;ver> Safari"). Mobile Internet Explorer [http://blogs.msdn.com/b/iemobile/archive/2010/03/25/ladies-and-gentlemen-please-welcome-the-ie-mobile-user-agent-string.aspx uses "IEMobile"]. So really, just sniffing for "Mobile" is the way to find all these mobile browsers. (Although iPad also says "Mobile".)


On the tablet side, Opera already calls itself "Opera Tablet" when running on a tablet, so there is also precedent for using that string to identify tablets, and for varying a tablet UA compared to desktop. The iPad identifies itself as an "iPad" instead of a "Macintosh" (clearly, Apple isn't going to use the generic device name).
On the tablet side, Opera already calls itself "Opera Tablet" when running on a tablet, so there is also precedent for using that string to identify tablets, and for varying a tablet UA compared to desktop. The iPad identifies itself as an "iPad" instead of a "Macintosh" (clearly, Apple isn't going to use the generic device name).


If the device is not actually a touch tablet, e.g. a netbook, we want a "desktop-like" UA. Saying the platform is "X11", while not always technically correct, is our attempt to balance accuracy, cross-platformness and compatibility with existing desktop sniffing.
If the device is not actually a touch tablet, e.g. a netbook, we want a "desktop-like" UA. We hope that we can use "Desktop" for this; we may get it added to the Firefox Desktop UA as well.


===Gecko Date===
===Gecko Date===


We have taken the opportunity to remove the Gecko date entirely (i.e. reduce to "Gecko/0" - as having <u>something</u> after the / is required by the HTTP spec). We have [http://hacks.mozilla.org/2010/09/final-user-agent-string-for-firefox-4/ warned people we are going to do this], and starting on mobile means less up-front extra breakage (given that we are making other changes at the same time). Doing this in two batches might mean we'd have to re-evangelise sites. Changing this on desktop can happen on an independent schedule (after, or even before).
We have taken the opportunity to remove the Gecko date entirely (i.e. reduce to "Gecko/12.0" - as having <u>something</u> after the / is required by the HTTP spec). We have [http://hacks.mozilla.org/2010/09/final-user-agent-string-for-firefox-4/ warned people we are going to do this], and starting on mobile means less up-front extra breakage (given that we are making other changes at the same time). Doing this in two batches might mean we'd have to re-evangelise sites. Changing this on desktop can happen on an independent schedule (after, or even before).


(If "Gecko/version" doesn't gain traction, what about "Gecko" without a version component? It is valid to have product tokens without a version. WebKit doesn't have a slash in its "like Gecko" string, and now seems like a good opportunity to get rid of nonsense strings, not add new ones like "Gecko/0").
We need a "/" because some people detect "Gecko/" to distinguish from "like Gecko". And so we need something after the /. 12.0 had the most support; it means the version number is in 3 times, but we'll have to live with that.


==Q&A==
==Q&A==
Line 51: Line 51:
===What happens next?===
===What happens next?===


This is a proposal. We want people to comment on whether our rationale is sound. It would also be useful to get data on whether it breaks a lot of stuff, or fixes a lot of stuff, or has no real effect (which would be a good result, actually).
This is a proposal which has been endorsed by the Fennec module owners as what they want to do for Fennec 11, the first release of Native Fennec.


===Do you think this will fix everything?===
===Do you think this will fix everything?===
Line 73: Line 73:
There is a large array of hardware out there on which the platforms which support Firefox Mobile run, and doubtless there will be more in the future. [https://bugzilla.mozilla.org/show_bug.cgi?id=625238 A bug] to add specific device information to the User Agent was WONTFIXED. The goal is for Firefox to work the same across all of these. In addition, adding hardware/OS information can have unexpected side effects; e.g. adding "Nokia" for the N900 led to us being served content appropriate for feature phones (non-smartphones).
There is a large array of hardware out there on which the platforms which support Firefox Mobile run, and doubtless there will be more in the future. [https://bugzilla.mozilla.org/show_bug.cgi?id=625238 A bug] to add specific device information to the User Agent was WONTFIXED. The goal is for Firefox to work the same across all of these. In addition, adding hardware/OS information can have unexpected side effects; e.g. adding "Nokia" for the N900 led to us being served content appropriate for feature phones (non-smartphones).


===What about the OS? Why don't you include the string "Android"?===
===Why "Android"?===


Because Firefox Mobile does not only run on Android, and we would like to discourage sites from sniffing for "Android" to mean "Mobile". B2G will probably not run on Android (in any meaningful sense - exact technology choices TBD yada yada) and so would prefer not to include "Android" in their User Agent; but they will still be running something on a phone which will work very like Firefox on Android. So it should have the same UA. The fewer sites who sniff for particular OSes, the better off we will be.
Because our analysis shows it makes an enormous difference in terms of getting a decent mobile site.


For tablets, it has been found that including the string "Android" in the UA is actually a disadvantage. Many sites have a "mobile" version and a desktop version. Given that choice, the desktop version is much better for tablets, but when sites see "Android", they take it to mean "Mobile", and send the mobile version.
B2G isn't Android and may well not say "Android"; we will have to work hard to get sites to not sniff for Android going forward. But right now, the Fennec team judged that we need it in there.
 
OS sniffing has some value on the desktop to allow sites to serve the appropriate downloads (Windows/Mac/Linux etc.) to users. As mobile and tablet users get most or all of their software via app stores, this use case does not apply.
 
The [http://android-developers.blogspot.com/2010/12/android-browser-user-agent-issues.html Android UA blogpost] talks about including the "Android" string so sites can supply Android-specific features. Of course, it is in their interests for websites to have Android-specific features; but it is not in the interests of the open web.


==Open Questions==
==Open Questions==
===Gecko Date===
There is a question of what should follow the slash - Gecko/0 avoids breaking sites which expect an integer. But a counter-argument suggests we should fail fast and break such sites, because if they do get an integer, they'll treat it like a date - and who knows what they'll make of "0". Other options include "#", "!", "X" and "12.0" (i.e. matching the Gecko version in the rv: string).
Dao: Let's please go with Gecko/12.0 or Gecko/12. (The latter might have less potential to break scripts.) There's no good reason to introduce new junk here and keep confusing people trying to make sense of the UA string. We should also freeze the rv: token and see if we can drop it in a few years time.


===Mozilla/5.0===
===Mozilla/5.0===
Line 96: Line 86:


Given that we are Mozilla, there's a strong emotional attachment there. But that may not be enough to outweigh the fewer-bytes-sent argument, if the compatibility impact is weak.
Given that we are Mozilla, there's a strong emotional attachment there. But that may not be enough to outweigh the fewer-bytes-sent argument, if the compatibility impact is weak.
===X11===
Is using X11 the right balance between desktop compatibility (it's a way of saying "not Windows, not Mac, and not any specific OS, but a desktop machine") and accuracy? Should we just bite the bullet and put "Desktop" in that space?
Account confirmers, Anti-spam team, Confirmed users, Bureaucrats and Sysops emeriti
4,925

edits