natevw / simplify-user-agent

User Agent helper library: simplify browser UA strings, match results using custom criteria
1 stars 0 forks source link

Provide migration path to UA Client Hints #1

Open natevw opened 2 years ago

natevw commented 2 years ago

At least some browser vendors intend to freeze the classic user agent string "soon":

It is to be replaced by something a lot closer to what this library intends to do, but with some key differences:

  1. it's based on an array of "brands" that ± always also includes a garbage value
  2. platform/browser/etc. values normalize differently (e.g. macOS instead of Macintosh, Google Chrome and Chromium instead of Chrome…)

Ideally we could help match browsers all the way from the first implementations of JS to this new future.

natevw commented 2 years ago

As far as the normalization, it's probably best to roll with the likely platform brand names under the new spec and see what the major browsers as far as their own brand names.

Then what do we do with this idea of a list of browser brands rather than the single one we currently attempt?

  1. Should we also return an array?
  2. What does this mean for matching?
  3. [Also, will this list give us useful insight on Safari-only platforms? Is Apple even on board with this spec at all?]
natevw commented 2 years ago
natevw commented 2 years ago

Given a list like:

  1. Google Chrome
  2. ))); DROP TABLE "not a brand"
  3. Chromium

How should e.g. all: [Chromium, not: Chrome] behave? It seems like:

but I'm struggling to put this in terms of https://en.wikipedia.org/wiki/De_Morgan's_laws or whatever :-)

UPDATE: well there's something, sortof