WICG / ua-client-hints

Wouldn't it be nice if `User-Agent` was a (set of) client hints?
https://wicg.github.io/ua-client-hints/
Other
590 stars 77 forks source link

Is it really necessary to deprecate navigator.appVersion, navigator.platform, navigator.productSub and navigator.vendor? #317

Closed NotLazy closed 2 years ago

NotLazy commented 2 years ago

On websites I've made that utilize Ctrl keyboard shortcuts, I've used navigator.platform to determine if the machine is mac, to modify those shortcuts into Cmd keyboard shortcuts. Maybe there's a better way, but the point is, why must we go through navigator.userAgentData just to get any low entropy values? Could we not simply continue to provide them via known and documented routes?

Before client hints were implemented in Chrome, navigator.platform returned "MacOS" but now that chrome has begun freezing data, it returns "MacIntel", which, even if it's wrong since I'm actually on Arm, feels like it's returning more data than before. Could we not have the specification just change these values to target client hints instead, since, via client hints, I can get the original "MacOS" from navigator.userAgentData.platform?

I know this is a very minor change, and really begs the question of "why can't you just add the .userAgentData before .platform?" but I feel like it's a waste to deprecate more JS features than just the userAgent.

miketaylr commented 2 years ago

Before client hints were implemented in Chrome, navigator.platform returned "MacOS"

@NotLazy can you describe which platform version + Chrome version this is true for? Thanks. Presumably M1 mac? Something else?

NotLazy commented 2 years ago

I'm not sure how to downgrade exactly since I have automatic updates turned on to be able to test for you, but definitely before chrome 100

miketaylr commented 2 years ago

OK - I'm unable to verify that (though I did not check all 99 version before 100 :)). As for the "deprecation" of these APIs - in reality, they will not disappear. Too much legacy web content depends on them. Instead, they will be "frozen".