Hacker News new | ask | show | jobs
by AndrewStephens 2377 days ago
I completely agree. Adding additional headers seems silly.

My counter proposal to the original article:

* User-Agent is almost neutered. It should send something like:

User-Agent: Browser (I want data I am going to display)

User-Agent: API-Client (I want some other data, a javascript call, etc)

And nothing else. I might possibly accept differentiating between desktop and mobile browsers. The javascript Window.navigator.userAgent should also be limited in the same way. No sane code uses it for anything. Of course, in the real world there is insane code all over the place so I suspect my modest proposal is a non-starter.

1 comments

Arguably browser vs. API client is already covered by the Accept header. A browser request has something like `Accept: text/html,application/xhtml+xml,[…]`, where an API client request has something like `Accept: application/json`.

If the client requests HTML, it’s a pretty safe assumption they want to have something display-able.

It's not even arguably - you are right. But the Accept header is also a mess these days and a lot of requests don't set it.