openroberta-lab icon indicating copy to clipboard operation
openroberta-lab copied to clipboard

Detect Windows 11

Open rbudde opened this issue 2 years ago • 2 comments

In our statistics we take the UserAgent-object, extract the operation system and log it. It turned out, that Windows 11 machines tell, that the operating system is "Windows 10". This was unexpected.

We have to get the real name of the client operating system. This seems to be not easy, as Firefox and Explorer don't support user agent hints (which seem to be needed).

Quote from a Microsoft resource: "User-Agent strings won't be updated to differentiate between Windows 11 and Windows 10, or to differentiate between CPU architectures. We don't recommend using User-Agent strings to retrieve user agent data. Browsers that don't support User-Agent Client Hints won't be able to differentiate between Windows 11 and Windows 10, or between CPU architectures."

See: https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11#sample-code-for-detecting-windows-11

rbudde avatar Jun 02 '23 13:06 rbudde

Where is this file located?

SamantaTarun avatar Jun 02 '23 19:06 SamantaTarun

server side in project OpenRobertaRobot there is in class Statistics a method infoUserAgent, which needs instead of userAgent.getOperatingSystem().getName(), (which seemed for us to be simply correct, this was so until Win 11) a more detailed analysis of the data in UserAgend to detect the right os.

rbudde avatar Jun 03 '23 11:06 rbudde