Open ruoshuiyx opened 2 years ago
$version = $agent->version($platform);
it is 10.0, but my computer is windows 11
Same issue.
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.
thianks ,I also use this
$version = $agent->version($platform);
it is 10.0, but my computer is windows 11