bowser-js / bowser

a browser detector
Other
5.47k stars 486 forks source link

satisfies() API should match "chrome" to any Chromium-based browser #450

Open erik-anderson opened 3 years ago

erik-anderson commented 3 years ago

Hi! I'm from the Microsoft Edge team. The Chromium-based version of Edge currently identifies itself with an "Edg/" token in addition to the "Chrome/" token.

We've found that developers of sites consuming UA detection libraries often don't think about engines but instead pick specific brands they want to declare support for.

This leaves other browser vendors in a difficult spot-- users get a bad experience even though the browser would work just fine, so browser vendors end up doing things like apply an override where we hide our UA string token.

Looking at the "Filtering browsers" example on the main README.md, I observe that the current Chromium-based version of Edge would not return true. It's not encouraging developers to think more broadly.

It would be preferable if developers had to explicitly indicate that they are truly trying to target Chrome vs. trying to scope some behavior to Chromium-based browsers.

One idea is that the satisfies() API should take an optional second argument that takes something like: { strictBrandMatch: true }

If strictBrandMatch is false or not present, Edge would match against the Chrome checks.

Ideally, this would apply even to the most basic APIs, reporting Chrome by default unless the developer explicitly notes that they truly want to differentiate between different Chromium-based browsers.

I realize this would essentially be a breaking change. At the same time, consumers of this library should understand that browser vendors are more likely to remove this context from the UA string which will leave them in the same spot anyway.

Reviewing issues, I understand that maintenance is fairly minimal on this project at this time. Would you be willing to accept a contribution from the Edge team?

Thanks!

PascalAOMS commented 3 years ago

I'd like to see this happen.

AzazKamaz commented 3 years ago

Actually library has engine detection that should detect Blink for any chromium based browser. Problem is that satisfies function doesn't check engines. Also functions isEngine, isPlatform and isOS are not exposed to type definitions