bestiejs / platform.js

A platform detection library.
https://mths.be/platform
MIT License
3.22k stars 408 forks source link

Detect Windows 11 (User-Agent Client Hints) #197

Open opusonline opened 2 years ago

opusonline commented 2 years ago

Hi. This library is extremely helpful!

Recently we came across the issue, that browsers don't report Windows 11 in the user agent string anymore.

A research revealed that there's a shift to new "User-Agent Client Hints" [1] and Windows made it even official [2] and forces developers to use this feature as the only way to detect Windows 11 (at least in Edge).

It would be awesome to see this feature also in platform.js.

Thanks in advance!

[1] https://web.dev/migrate-to-ua-ch/ [2] https://docs.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11

culdo commented 1 year ago

If you use user-agent to detecting OS, you can consider to use UAParser.js.