Live data from Hacker News

UA Gotta Be Kidding

bkardell.com

21–30 of 93 posts

Re: UA Gotta Be Kidding

#21

I think it's interesting to note that the majority of web developers for at least the last 10 years have realised that the User Agent is a very flaky way to determine capability. It is almost universally ignored now (with a few enterprise-level exceptions) So the usual solution is feature detection, where the javascript and/or CSS learns the true capabilities of the browser, and switches features on and off according…

Sadly there are situations where "feature detection" is not really an option e.g. when safari does something really weird and you need a special codepath for it server-side (like the video player not working if the server doesn't support content-range, so you have to not send a video to safari in that case).

> like the video player not working if the server doesn't support content-range

Yeah, I got bitten by that one too. Pretty darn annoying especially because Safari doesn't tell you what is wrong.

Re: UA Gotta Be Kidding

#22
UA reduction has officially started with Chrome 101: The UA string is not sending the minor version anymore, only 0.0.0.

This is the beginning of the end for the UA string. As more and more UA reductions are deployed, the UA hints will become more useful and eventually depreciate the UA string entirely.

https://www.chromium.org/updates/ua-reduction/

https://wicg.github.io/ua-client-hints/

Re: UA Gotta Be Kidding

#23

I think it's interesting to note that the majority of web developers for at least the last 10 years have realised that the User Agent is a very flaky way to determine capability. It is almost universally ignored now (with a few enterprise-level exceptions) So the usual solution is feature detection, where the javascript and/or CSS learns the true capabilities of the browser, and switches features on and off according…

if browsers would stop lying about dpi, we wouldn't need to guess trough UA wheter something is a low res desktop, a high resolution small monitor or something in between (and let's not start talking about browser windows that aren't fullscreen).

once we could at least use the availability of touch features to guide between the cases, but now that one started lying as well.

we parse user agent not because we like to but because the absolute shitshow that's the metrics system on browsers.

Re: UA Gotta Be Kidding

#24

The whole privacy-through-UA thing maybe gone too far though. Safari on M1 Mac identifies itself as Intel Safari. A web server knowing whether you use an older or newer Mac is not going hurt anyone, but the lack of it does hurt the UX of distributing Mac apps. For download size reasons you really want to give the user a build for the right CPU architecture, but due to this lie you have to either ship a fat app to Saf…

> Really there's nothing wrong with having a UA header but it gets abused because HTTP never had any standardized way to communicate feature sets. It should have had both. A way to identify specific apps for bug workarounds etc, and a way to communicate what versions and parts of the specs are implemented.

The problems with this is that it's an adversarial market. It's not quite as bad as it used to be, now that there's almost no cases where the same company controls both the server and the browser (with the very big exception of visiting google.com). But there's still incentives to not treat different browsers the same way, or for the browser to lie about capabilities.

One silver lining of moving so much CPU-intensive site building work to clients is that feature/bug detection can be done there, live, where it has more chance of actually testing the thing you want to check for.

Re: UA Gotta Be Kidding

#26

The whole privacy-through-UA thing maybe gone too far though. Safari on M1 Mac identifies itself as Intel Safari. A web server knowing whether you use an older or newer Mac is not going hurt anyone, but the lack of it does hurt the UX of distributing Mac apps. For download size reasons you really want to give the user a build for the right CPU architecture, but due to this lie you have to either ship a fat app to Saf…

Its pretty shitty that you are forced to use javascript to know something basic like this. I get the purpose of redacting some information to improve privacy, fighting the fingerprinting, etc... but the basic utility of the user agent string is to help facilitate simple things like showing users the right content for their platform, macOS vs Windows, x86 vs Arm, etc... making this not work is just such a disappointment.

Re: UA Gotta Be Kidding

#27
post #9
post #8

Earlier quoted context omitted.

Upon opening the article the first line would have informed you otherwise. Instead you felt compelled to instead reply to tell everyone you know that UA is the Ukrainian ISO code. Did you really find the comments "confusing", or is that artistic license? It comes across like, "I couldn't just read the headline and immediately post my reaction to it". You're not the first to have this reaction to HN articles, and you…

I did find it confusing and I often read the comments first, because I usually find them more interesting. The first line of the article did inform me otherwise: your insight is accurate. I didn't mean to degrade your forum experience. Edit: by the way, if you want don't want to be dismissive of whatever good there is in HN's community, you'd do well not to presume that others are dishonest ("artisticly licensed"). I…

Honestly, there's no point interacting with these people. Your comment was a perfectly fine chatty observation about the name of the article. 99.9% of people here aren't robots annoyed at any hint of spontaneity - most of us appreciate the odd unexpected turn that injects something different into the discussion. The ways we miss our lives are life :)

Re: UA Gotta Be Kidding

#28

I think it's interesting to note that the majority of web developers for at least the last 10 years have realised that the User Agent is a very flaky way to determine capability. It is almost universally ignored now (with a few enterprise-level exceptions) So the usual solution is feature detection, where the javascript and/or CSS learns the true capabilities of the browser, and switches features on and off according…

Sadly there are situations where "feature detection" is not really an option e.g. when safari does something really weird and you need a special codepath for it server-side (like the video player not working if the server doesn't support content-range, so you have to not send a video to safari in that case).

wouldn't it be easier to add support for content-range instead of adding quirk to exclude videos for safari?

Re: UA Gotta Be Kidding

#29
post #5

Is there something like a "capabilities declaration" in the works to actually solve the problem? You know, something like a "X-I-Support: images, frames, ecma6, vr, xss" header? I could even imagine an "assigned capability strings" database and x- prefixes and all, but it's probably an old fool's dream in these fast-m— thing-breaking times.

I don't think we should be adding even more overhead to HTTP requests.

Re: UA Gotta Be Kidding

#30
post #25

Just think of the terrabytes of wasted bandwidth, there s like 60 spaces in those strings

Well, you'd have to separate the different values in the User-Agent somehow, what character would you suggest? They all take the same amount of space (no pun intended).

If you're worried about spaces in user-agents wasting bandwidth, there are a awful lot of windmills you'd have to bark at every day, I do not envy you.

Post reply on HN