TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

User-Agent Reduction

76 pointsby kkmover 2 years ago

13 comments

jraphover 2 years ago
When I got started with the web 15 years ago, it was advised everywhere not to rely on user agent strings and rely on feature detection instead, and that using the user agent string should be a last resort solution.<p>Today, we are still seeing issues &quot;solved&quot; by switching one&#x27;s user agents. And here we are reading Akamai whining about user agents getting unreliable. And we are talking unreliable <i>at the minor version</i> and specific platform version level.<p>It&#x27;s not like we weren&#x27;t warned ahead of time.<p>I&#x27;m sure problems will be sorted by proper http headers, data in handshakes or other things. And they should. Nobody should have to read user agent strings to optimize things, because things should also be optimized for a new, unknown user agent that would support these optimizations.
评论 #33468964 未加载
评论 #33470897 未加载
评论 #33465754 未加载
评论 #33465146 未加载
评论 #33475989 未加载
评论 #33470948 未加载
computerfriendover 2 years ago
User agent strings are such a train wreck. I wish Chrome was braver and changed it to something like &quot;Chromium (Blink, V8); Linux (Android)&quot;.
评论 #33463672 未加载
评论 #33467313 未加载
评论 #33463848 未加载
评论 #33475378 未加载
klabb3over 2 years ago
Eh. I guess I&#x27;m happy with any reduction of entropy in the UA string (which today almost contains your family name and dogs favorite meal in an unparseable string blob). But &quot;client hints&quot; seems like very little bang (device-specific cdn assets?) for the buck (an interactive, configurable and stateful protocol). And if this is for privacy reasons, but you can circumvent it by requesting client hints, then won&#x27;t that end up an always-on default anyway that nobody benefits from in practice?<p>I guess if it&#x27;s <i>fine</i> if users and devs don&#x27;t need to think about it. OTOH, this is yet another barrier to competition in the browser space, which we desperately need to curb.<p>It seems like someone should overhaul the whole privacy mess with cookies, fingerprinting, user agents and other remnants from the 90s and take a <i>slightly</i> more principled approach to making a sane single standard, instead of adding hundreds of highly specific single-purpose headers and JS APIs.
评论 #33464835 未加载
评论 #33464822 未加载
iiccover 2 years ago
I&#x27;ve been blocked from an Akamai fenced website because I used Firefox for Android. Not great when you have a plane ticket you need to change.
评论 #33465264 未加载
daveoc64over 2 years ago
While I am personally in favour of feature sniffing, rather than user agent sniffing, I think it&#x27;s worth remembering the debacle about how the SameSite attribute on cookies was handled by the browsers a few years ago.<p>Several browsers shipped with an old implementation of the spec that is incompatible with the most recent, current version of the spec.<p>Setting the SameSite attribute to a specific value can result in the site working in newer browsers, but not in older browsers (or vice versa).<p>The only way to handle this is to sniff for a specific set of old browsers by user agent string, and to alter how cookies are set for those:<p><a href="https:&#x2F;&#x2F;www.chromium.org&#x2F;updates&#x2F;same-site&#x2F;incompatible-clients&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.chromium.org&#x2F;updates&#x2F;same-site&#x2F;incompatible-clie...</a><p>Due to the prevalence of old iOS devices that can&#x27;t be updated with a more modern browser (especially iPads), the company I work for has to keep this user agent sniffing in our codebases going forward.<p>If the user agent string is going to be deprecated or significantly weakened, there needs to be effort among browser vendors to avoid something like this ever happening again.
评论 #33467425 未加载
forgotmypw17over 2 years ago
I look forward to Google-Chrome-Web (GCW) fully separating into its AOL-ish self and leaving the Good Web alone for us geeks to revel in.
politelemonover 2 years ago
&gt; The Chrome team expects the highlighted portions to be changed to:<p>I cannot see what they have highlighted.
评论 #33463647 未加载
njsubediover 2 years ago
If only browsers had similar behavior across the platform and devices, user-agent wouldn’t be so useful to servers. They wouldn’t need to respond with customized content for each different user agent. As a developer, I’d prefer having to deal with at most a few dozen UAs instead of hundreds of specific ones.
评论 #33463675 未加载
UpToTheSkyover 2 years ago
Someone should also look into the &quot;navigator&quot; variable that websites can access. It provides a strangely open look into the user&#x27;s machine.<p>For example, it allows websites to know about your OS, your CPU and your memory.<p>The &quot;window&quot; object also provides data that I would consider private. Like the screen size. Websites should only know the window size.<p>Demo: <a href="https:&#x2F;&#x2F;jsfiddle.net&#x2F;uvtLc784&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jsfiddle.net&#x2F;uvtLc784&#x2F;</a>
评论 #33468073 未加载
评论 #33464150 未加载
Havocover 2 years ago
I can see reduced granularity but that seems a touch extreme?<p>I’d rather google work on all the other info that leaks
charonn0over 2 years ago
Seems like a relevant time to bring up this old chestnut:<p><a href="https:&#x2F;&#x2F;webaim.org&#x2F;blog&#x2F;user-agent-string-history&#x2F;" rel="nofollow">https:&#x2F;&#x2F;webaim.org&#x2F;blog&#x2F;user-agent-string-history&#x2F;</a>
donatjover 2 years ago
Similarly related, no longer being able to tell iPad OS and macOS apart server side was a major blow for us.<p>We have essentially “continue this in the app” buttons whose existence and how they passed state (iOS vs Android) was determined server side. We rewrote that all to happen client side because you can check “is it a Mac?” &amp;&amp; “does it have multi-touch support?” And know it’s an iPad - at least until they build a touchscreen Mac.
评论 #33469289 未加载
bullenover 2 years ago
This would sort itself out if browser implementations followed the standard and allowed us to set the user-agent ourselves.<p>Personally I would then set it to 1, 2 or 3 and have my server handle those cases.<p>Right now then ONLY user-agent code I have running is this:<p><pre><code> navigator.userAgent.indexOf(&#x27;Android&#x27;) == -1 &amp;&amp; navigator.userAgent.indexOf(&#x27;Other&#x27;) == -1 &amp;&amp; navigator.userAgent.indexOf(&#x27;SamsungBrowser&#x27;) == -1 </code></pre> Good job Samsung&#x2F;Google!