目前,
在Windows-11设备上,我得到navigator.userAgent
值为Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.77
,这与Windows-10相同。
为了区分Windows-10和Windows11,我使用了用户代理客户端提示
navigator.userAgentData.getHighEntropyValues(['platformVersion']).then(function(uapv){
console.log(uapv.platformVersion);
var winVer = Number(uapv.platformVersion.split('.')[0]);
if(winVer>10){
console.log("It's Win11")
}else{
console.log("It's Not Win11");
}
});
但,
用户-代理客户端提示仅在Chrome/Edge/Opera中得到支持,而在火狐中则不支持。
那么,是否有一种技术/库可用于检测 Firefox 中的Windows11?
发布于 2022-08-01 16:00:48
试试这个图书馆:
https://github.com/bestiejs/platform.js
然后,执行platform.os
,它应该给您提供如下内容:Windows Server 2008 R2 / 7 x64
7
是这里的版本。
https://stackoverflow.com/questions/73196477
复制相似问题