this post was submitted on 20 Sep 2024
255 points (100.0% liked)

Programmer Humor

428 readers
3 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

alt textCaption

Web dev: What browser is visiting the page?

User agent string:

A screenshot of a browser. The URL bar reads firefox://settings, a button on the URL bar is labelled Netscape, a popup from the button reads: "You're viewing a secure Opera page", and the web page title reads "Chrome settings".

you are viewing a single comment's thread
view the rest of the comments
[–] apprehentice@lemmy.enchanted.social 84 points 5 months ago (4 children)

Functionally useless. With the web standardized, we shouldn't need user agents anyway. It would be more beneficial to ask "do you support X, Y, and Z?"

[–] Maestro@fedia.io 25 points 5 months ago (1 children)

It's called feature detection and it goes a long way back, even before Modernizr popularized it.

[–] GammaGames 7 points 5 months ago (2 children)

Popularized? That gets less than 100k downloads a week

[–] dan@upvote.au 14 points 5 months ago* (last edited 5 months ago) (1 children)

Most developers just write their own feature checks (a lot of detections are just a single line of code) or use a library that polyfills the feature if it's missing.

The person you're replying to is right, though. Modernizr popularized this approach. It predates npm, and npm still isn't their main distribution method, so the npm download numbers don't mean anything.

[–] GammaGames 3 points 5 months ago

Neat, thanks for clarifying! I’ve never heard of it

It used to be huge.

[–] dan@upvote.au 15 points 5 months ago

That's exactly what you're supposed to do with the modern web, via feature detection and client hints.

The user agent in Chrome (and I think Firefox too) is "frozen" now, meaning it no longer receives any major updates.

[–] bleistift2@sopuli.xyz 1 points 5 months ago* (last edited 5 months ago)

I know Safari 15.3 doesn’t support feature Y, but I also know the current version does. Now I want to know if I can just use the feature or if I need to program around Safari 15.3. It would be nice to just look at the server logs from last month and see if someone still uses it.

load more comments (1 replies)