Fennec/User Agent: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 21: Line 21:
==Rationale==
==Rationale==


User Agent strings accumulate cruft, and complex ones lead to server-side parsing which makes all sorts of wrong assumptions about browser capabilities which can't then be fixed on the client-side apart from by adding more cruft. Note what happened when sites started using "Gecko" as a synonym for "standards-compliant"; WebKit browsers still have "like Gecko" stuck in their User Agents. Here's an example from current iPads:
User Agent strings accumulate cruft, and complex ones lead to server-side parsing which makes all sorts of wrong assumptions about browser capabilities which can't then be fixed on the client-side apart from by adding more cruft. Note what happened when sites started using "Gecko" as a synonym for "standards-compliant"; WebKit browsers still have "like Gecko" stuck in their User Agents. Here's a highly crufty example from current iPads:


   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 browser fingerprinting. For this reason, we have done 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.


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


The string above fits with the [http://hacks.mozilla.org/2010/09/final-user-agent-string-for-firefox-4/ user agent for Firefox 4 and above] on desktop. (Our proposal is intended to replace what that blog post says about Mobile.) It also fits with the guidelines of the [https://developer.mozilla.org/en/Gecko_user_agent_string_reference Gecko User Agent String reference] for Firefox products.
The string above fits with the [http://hacks.mozilla.org/2010/09/final-user-agent-string-for-firefox-4/ user agent for Firefox 4 and above] on desktop. (Our proposal is intended to replace what that blog post says about Mobile.) It also fits with the guidelines of the [https://developer.mozilla.org/en/Gecko_user_agent_string_reference Gecko User Agent String reference] for Firefox products.


We have removed the "Fennec" identifier because we don't want sites to detect that instead of Firefox or "Mobile" or "Tablet". Our market share is currently small enough that we hope we can get away with this without breaking too many sites. Mobile Firefox is Firefox - it's not something else. That's one of its great selling points - same browser engine everywhere.
===Fennec/Firefox===
 
We have removed the "Fennec" identifier because we don't want sites to detect that instead of Firefox or "Mobile" or "Tablet". Our market share is currently small enough that we hope we can get away with this without breaking too many sites. Mobile Firefox is Firefox - it's not something else. That's one of its great selling points - you get the same browser engine everywhere. Our UA string should reflect that.
 
===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 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".)
Line 38: Line 42:


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. Saying the platform is "X11", while not always technically correct, is our attempt to balance accuracy, cross-platformness and compatibility with existing desktop sniffing.
===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/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).
Line 61: Line 67:
However, it is reasonable for sites to adapt behaviour to tablets as compared to desktops. For example, touch devices have no concept of "mouseover". There's no obvious way to indicate that other than in the UA. Some sites differentiate iPad vs. Mac using UA sniffing, and convincing them to use a mechanism other than UA sniffing would be difficult.
However, it is reasonable for sites to adapt behaviour to tablets as compared to desktops. For example, touch devices have no concept of "mouseover". There's no obvious way to indicate that other than in the UA. Some sites differentiate iPad vs. Mac using UA sniffing, and convincing them to use a mechanism other than UA sniffing would be difficult.


===What about the hardware versions?===
===What about the hardware version?===


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).
Account confirmers, Anti-spam team, Confirmed users, Bureaucrats and Sysops emeriti
4,925

edits

Navigation menu