3 ms·
Unfortunately, encouraging people to parse the UA header leads to them getting it wrong in a way that would be amusing if it wasn't so irritating. For example
by jgraham 12y ago
Unfortunately, encouraging people to parse the UA header leads to them getting it wrong in a way that would be amusing if it wasn't so irritating.
For example FirefoxOS has a UA string of the from User-Agent:Mozilla/5.0 Mobile Gecko/28 Firefox/32.0'. There's an example in bugzilla of a major site that, not only depends on the file details of that format, but will send the mobile version of the site if and only if the number after Firefox is even and in the range 18 < = x <= 34.
Such examples are not one-offs either. In fact it is so common for sites to screw up here that browser vendors often resort to sending specially crafted UA strings to certain sites in order that the content become accessible. The most extreme example of this was pre-blink Opera which had much better compat than it was given credit for, but was often blocked — acidentially or intentionally — from sites that effectively whitelisted certain browsers. As a result it used an auto-updated list of sites for which it had to send an alternate UA string [1] as well as a sophisticated system of javascript injection to work around more complex bugs in these sites [2].
[1] https://github.com/operasoftware/browserjs/blob/master/desktop/spoofs.xml https://github.com/operasoftware/browserjs/blob/master/deskt...
[2] https://github.com/operasoftware/browserjs/blob/master/desktop/browserjs-12.50.js https://github.com/operasoftware/browserjs/blob/master/deskt...
- markbnj 12y agoThere's a whole class of old ASP sites that break if you take "like Gecko" out of the UA. It would be funny if it hadn't made me cry so often.
- drdaeman 12y agoWhy not just break them?
- vertex-four 12y agoBecause then people use a competing browser that doesn't break the sites they use.
- drdaeman 12y agoSeriously doubt it. Backwards-incompatible changes (mostly, deprecating some old kludges) had happened many times and I don't think there were any severe migrations. I'm really not sure cons of User-Agent cleanup (or complete deprecation) outweigh the pros. At the very least I think it's not obvious and is debatable.
- cbr 12y agoWhat are the pros? Smaller requests are only going to have a very small effect on speed or bytes used.
- drdaeman 12y agoSmaller requests, right. Also, some privacy improvements by having less data for browser fingerprinting. Also, if we'd consider dropping User-Agent header altogether, less ways to detect an UA, so a bit harder to show "sorry, your browser in unsupported, this site is IE^H^H Chrome-only" Obviously, just UA header isn't even remotely sufficient for any of those reasons, but would be a good start.
- deleted 12y ago[deleted]
- markbnj 12y agoIt's not our call. We run a specialty aggregating search engine for a certain class of professionals, and the sites we pull data from were mostly developed when Clinton was president, as far as I can tell. We had a set of probably ten or fifteen sites that just wouldn't work right until we added "like Gecko" to the UA. Like I said, it would have been funny if we hadn't been tearing our hair out trying to figure out why the postback call wasn't firing.
- ronancremin 12y agoThe trick is not to do it yourself, this is a complex enough problem that it's worth leaving to others to do if it really matters to you. https://github.com/OpenDDRdotORG/OpenDDR-Resources https://github.com/OpenDDRdotORG/OpenDDR-Resources http://deviceatlas.com http://deviceatlas.com