-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
In windows 11 user agent always is "Windows NT 10.0"
If you want to read the "Sec-CH-UA-Platform-Version" header
- The server needs set
header("accept-ch: Sec-Ch-Ua-Platform, Sec-Ch-Ua-Platform-Version") ;
- Subsequent requests will have
Sec-CH-UA-Platform
andSec-CH-UA-Platform-Version
headers. - Check header:
Sec-CH-UA-Platform
= "Windows" andSec-CH-UA-Platform-Version
>= 13
Related links
https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11
This is an example:
<?php
header("accept-ch: Sec-Ch-Ua-Platform, Sec-Ch-Ua-Platform-Version");
function isWin11(){
if(isset($_SERVER['HTTP_SEC_CH_UA_PLATFORM']) &&
$_SERVER['HTTP_SEC_CH_UA_PLATFORM'] == '"Windows"' &&
isset($_SERVER['HTTP_SEC_CH_UA_PLATFORM_VERSION'])){
if(13 <= intval(explode(".", preg_replace('/^"|"$/i', "", $_SERVER['HTTP_SEC_CH_UA_PLATFORM_VERSION']))[0])){
return true;
}
}
return false;
}
echo isWin11();
Test environment:
Sccess
✅ Windows 11 ; Chrome/117
✅ Windows 11 ; Edge/117
Not support
❌ Windows 11 ; Firefox/113
Metadata
Metadata
Assignees
Labels
No labels