I have a website and I would like to differentiate between win 10 and win 11. As the user agent between the both is the same, I’m looking for a solution. Does anyone has an idea?
thx,
Eric
Hey Eric,
I think the first question to ask is, why do you need to know which version of Windows it is? Are you trying to use a specific feature that is only available on the newer version? Is this across all browsers or only Edge?
Schalk
Staff Community Manager - MDN Web Docs
Hey Schalk,
Yes indeed, depending on the Os version I need to provide a different message to the user. Our product runs on Firefox, Edge Chromium and Chrome.
For Edge & chrome I’m using this : https://docs.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11. But as you can see, FF does not sustain it…
Ah yes I see, User Agent Client Hints
is not yet support by Firefox and Safari. I would have thought falling back to using a regular expression but, in Firefox at least, the version reporting has been capped at Windows 10 ~ https://bugzilla.mozilla.org/show_bug.cgi?id=1693295
I wonder if you can do something like this: https://codepen.io/schalkneethling/pen/dyJqmjr?editors=0011