WICG/ua-client-hints

`platformVersion` showing different version number

pranavn9 opened this issue · 11 comments

Good day team!

Concern

I was trying out the getHighEntropyValues in the Chrome console, when I noticed that the platformVersion value was returning as "8.0.0", instead of what I thought should be "10.0.0" since I'm running Windows 10.

ua-check

System and browser specifications

Current OS and Version : Windows 10 Pro (10.0.18363 N/A Build 18363)
Browser 1: Edge Version 99.0.1150.39 (Official build) (64-bit)
Browser 2: Chrome Version 98.0.4758.102 (Official Build) (64-bit)

Initial research

While checking out this part of the spec, I read about a reference where it searches for Windows.Foundation.UniversalApiContract value to then convert to a string. I searched for a way to check it via the file explorer and found that you'll generally get it at C:\Program Files (x86)\Windows Kits. I checked with a few of my colleagues and realized that this might somehow not be relevant since having folders of 8.1 and/or 10 inside Windows Kits, gave inconsistent results.

What I believe, is causing the difference, is actually the Windows Version itself (All are running Windows 10 Pro)! This is the similarity I saw:
Case 1
Edition Windows 10 Pro
Version 21H2
OS build 19044.1466
Output: "platformVersion" : "10.0.0" ✅

Case 2
Version 1909
OS build 18363.1440
Output: "platformVersion" : "8.0.0" ❌

Case 3
Version 1909
OS build 18363.1556
Output: "platformVersion" : "8.0.0" ❌

Case 4
Version 21H2
OS build 19044.1526
Output: "platformVersion" : "10.0.0" ✅

Case 5
Version 21H2
OS build 19044.1526
Output: "platformVersion" : "10.0.0" ✅

On a side note, I also checked the navigator.userAgent, which returns the same string across all the cases above (barring the chrome version) : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36.

My use-case

I'm currently trying to ascertain the impact of moving logic to the new user hints way, since we do have code using navigator.userAgent. I just wanted to bring this to your notice since we do have multiple clients running older versions of windows and have to adhere to scheduled updates in a year, which means the computation of platformVersion should have backward compatibility based on windows versions too.

I apologize in advance in case there was something obvious here, which I have missed or not explained clearly!

HI @pranav-nanjappa, thanks for the report.

On Windows, Sec-CH-UA-Platform-Version doesn't return the OS version, but the Api Contract version. Microsoft wrote up some nice documentation at https://docs.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11.

I apologize in advance in case there was something obvious here, which I have missed or not explained clearly!

Nah, no need to apologize. I can see how it can be confusing. We should probably add a Note in the spec clarifying things.

Based on my read, it looks like your results seem sensible, but cc @erik-anderson to double check.

Yes, the values you’re seeing are what’s expected. If you have questions after reviewing the help content on the Microsoft site that Mike linked to please feel free to ask here.

Thank you so much @miketaylr and @erik-anderson! After reading that part of the documentation, everything definitely fell into place! :D I have just one parting question around this, which is whether there is a similar kind of platform versioning happening on the Mac as well for Chrome? I was wondering whether for, say Catalina, the platformVersion would end up returning 10.15 or something like its Darwin version of 19 (which I found here)?

@pranav-nanjappa platform version returns a version string that makes the most sense for each platform. So, for maOS, it would be something like 11.6.4 or 10.15.7, etc. For Linux, it returns the empty string (because it doesn't really make much sense).

Hope that helps! I'll close here, but feel free to keep asking questions.

Yes perfect, this is plenty! Thanks a bunch for the clarifications around this. This was super helpful @miketaylr!

Does anyone knows the platformVersion mapping of Chrome OS ?

@woody-li can you explain more what you're looking for?

@miketaylr Thanks for your reply.

On Windows, Sec-CH-UA-Platform-Version doesn't return the OS version

Tested on Chrome OS, the platformVersion value seems like not match real OS version also.

Does platformVersion even make sense on Chrome OS? Isn't it typically the same as the browser version?

Chrome OS does have it's own platform version that is different from the Chrome version. It's possible there is a 1-1 map between the two though. For example in this post you can see that the Chrome version is 120.0.6099.235 but the platform version is 15662.76.0.

I believe the platform version is being derived from OperatingSystemVersionNumbers but I am not sure what they mean or how they map to the Chrome version.

Thanks @bvattikonda! In theory I may have known that at some point. 😅