Microsoft says we can use the following javascript to detect Windows 11 (on the client side):
navigator.userAgentData.getHighEntropyValues(
["architecture", "model", "platform", "platformVersion", "uaFullVersion"])
.then(ua => { console.log(ua) });
The response should be like: platformVersion: "14.0.0"
.
I need to use this as a variable in my PHP to detect if a user is using Windows 11:
if(is_browser_request()){
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$systemid = $_SERVER['HTTP_SEC_CH_UA_PLATFORM'];
$version = Unknown how to define
if (stripos($user_agent, "iPhone")!==false) {
$brand = 'iPhone';
} else if ($version == "14.0.0") {
$brand = 'Win11';
} else if ($version == "10.0.0") {
$brand = 'Win10';
Does this make sense? How can I get the javascript added in my php and define the $version?