jenssegers / agent

👮 A PHP desktop/mobile user agent parser with support for Laravel, based on Mobiledetect
https://jenssegers.com
MIT License
4.53k stars 473 forks source link

windows 11 version is wrong #198

Open ruoshuiyx opened 2 years ago

ruoshuiyx commented 2 years ago

$version = $agent->version($platform); it is 10.0, but my computer is windows 11

mdobydullah commented 2 years ago

$version = $agent->version($platform); it is 10.0, but my computer is windows 11

Same issue.

Khuthaily commented 1 year ago

I am not sure if there is a way to detect Windows 11 at the server level (yet). Based on my Microsoft, we can detect Windows 11 from with JavaScript (see code below). I tweaked their code to send the version to the server via AJAX (as a POST method). It has been working fine for for me.

navigator.userAgentData.getHighEntropyValues(["platformVersion"])
 .then(ua => {
   if (navigator.userAgentData.platform === "Windows") {
     const majorPlatformVersion = parseInt(ua.platformVersion.split('.')[0]);
     if (majorPlatformVersion >= 13) {
       console.log("Windows 11 or later");
      }
      else if (majorPlatformVersion > 0) {
        console.log("Windows 10");
      }
      else {
        console.log("Before Windows 10");
      }
   }
   else {
     console.log("Not running on Windows");
   }
 });

If someone has a better approach via PHP, please share.

ruoshuiyx commented 1 year ago

thianks ,I also use this