329

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 97 points 14 hours ago

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

[-] PenisDuckCuck9001@lemmynsfw.com 3 points 2 hours ago

You have to use user agents to fool scummy websites into thinking that you're using chrome or edge.

[-] elrik@lemmy.world 4 points 2 hours ago

User agents are useful for checking if the request was made by a (legitimate self-identifying) bot, such as Googlebot.

It could also be used in some specific scenarios where you control the client and want to easily identify your client traffic in request logs.

Or maybe you offer a download on your site and you want to reorder your list to highlight the most likely correct binary for the platform in the user agent.

There are plenty of reasonable uses for user agent that have nothing to do with feature detection.

[-] dan@upvote.au 16 points 10 hours 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.

[-] Maestro@fedia.io 29 points 14 hours ago

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

[-] GammaGames@beehaw.org 5 points 11 hours ago

Popularized? That gets less than 100k downloads a week

[-] dan@upvote.au 6 points 10 hours ago* (last edited 10 hours ago)

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@beehaw.org 1 points 9 hours ago

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

It used to be huge.

[-] Xanthrax@lemmy.world 9 points 11 hours ago* (last edited 11 hours ago)

Web UI for touch screens is a lot different than keyboard and mouse. I still switch to desktop most of the time because the mobile site will lack critical info, though. They "have" to streamline the experience for mobile, but I hate it when they fully remove features.

[-] Quacksalber@sh.itjust.works 13 points 13 hours ago

Youtube currently (for weeks now) does not work on Firefox, if you don't use a Firefox user agent. Google doing sketchy things again.

[-] RustyNova@lemmy.world 2 points 3 hours ago

Uh... I use librewolf that force a chrome + windows user agent and its totally fine?

[-] Quacksalber@sh.itjust.works 1 points 3 hours ago

Then charmeleon must change more than just the user agent

[-] Carighan@lemmy.world 6 points 4 hours ago
[-] Quacksalber@sh.itjust.works 1 points 3 hours ago

What works? YT on Firefox or YT on Firefox when the user agent is changed?

[-] Carighan@lemmy.world 3 points 2 hours ago

Both. I use YT on Firefox constantly, and I just explicitly tried again with a swapped user agent, and there's no issues at all, works perfectly as expected. I saw from your other reply that you use a fairly involved and heavily modifying expansion, not just a user agent switcher.

If you try to "harden" your FF, always keep in mind that a large portion of that means absolutely breaking things left and right and center. It might work, but always expect it will not. Because it's just not something anybody would ever test for when creating web pages. So you're running essentially unknown scenarios. It might be interesting input to the extension-author that this breaks, though. It might be something they think they got working. Of course, it could also be that it's "Yeah that happens, it's intentional". But might as well report it to them.

[-] tyler@programming.dev 13 points 9 hours ago

YouTube works fine on Firefox…

[-] KairuByte@lemmy.dbzer0.com 29 points 12 hours ago

I’ve not run into this issue and use Firefox exclusively with ublock origin

[-] Quacksalber@sh.itjust.works 2 points 12 hours ago

I use Charmeleon, with the effects described above.

[-] Carighan@lemmy.world 0 points 4 hours ago* (last edited 4 hours ago)

So you don't use Firefox, you mess with Firefox. That's on you then. Devs can't be held responsible for you intentionally breaking things. Only do what you know works.

[-] sacbuntchris@lemmy.world 9 points 13 hours ago

Lazy web developers or clueless managers have entered the chat

this post was submitted on 20 Sep 2024
329 points (98.8% liked)

Programmer Humor

19198 readers
1270 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 1 year ago
MODERATORS