alt text

Caption

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”.

31 points

“yer a jedi, harry” - Gandalf

permalink
report
reply
2 points

Listen here, Gandalf, you fat oaf! I’m not a fucking Jedi!

permalink
report
parent
reply
35 points
*

User agents are essentially deprecated and are going to become less and less useful over time. The replacement is either client hints or feature detection, depending on what you’re using it for.

permalink
report
reply
18 points

A URL is not an agent string, just saying.

permalink
report
reply
103 points

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

permalink
report
reply
4 points

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

permalink
report
parent
reply
5 points

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.

permalink
report
parent
reply
17 points

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.

permalink
report
parent
reply
31 points

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

permalink
report
parent
reply
5 points

Popularized? That gets less than 100k downloads a week

permalink
report
parent
reply
6 points
*

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.

permalink
report
parent
reply
2 points

It used to be huge.

permalink
report
parent
reply
9 points
*

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.

permalink
report
parent
reply
13 points

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

permalink
report
parent
reply
6 points

It works fine?

permalink
report
parent
reply
1 point

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

permalink
report
parent
reply
2 points

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

permalink
report
parent
reply
1 point

Then charmeleon must change more than just the user agent

permalink
report
parent
reply
13 points

YouTube works fine on Firefox…

permalink
report
parent
reply
29 points

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

permalink
report
parent
reply
2 points

I use Charmeleon, with the effects described above.

permalink
report
parent
reply
9 points

Lazy web developers or clueless managers have entered the chat

permalink
report
parent
reply
19 points

Is it… (scrolls wheel of browsers) Lynx?

permalink
report
reply
9 points
*

I’m still amazed at how usable Lynx is, given the insane premise of the application.

permalink
report
parent
reply
4 points

What’s so insane about it? Web browsers are an evolution of the old gopher protocol. All this stuff has roots in text consoles.

permalink
report
parent
reply
1 point

The history makes plenty of sense, and explains why it’s there in the fist place. The modern internet was not designed to use by console, though.

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 7.2K

    Monthly active users

  • 954

    Posts

  • 37K

    Comments