mumuy / browser

浏览器检测 - Useragent分析/浏览器识别/浏览器判断/UA解析/用户代理信息/Useragent analysis tool/Browser detection
https://passer-by.com/browser/
MIT License
1.5k stars 327 forks source link

增加 Windows 11 检查 #61

Closed ArgoZhang closed 2 years ago

ArgoZhang commented 2 years ago
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");
   }
 });

等有时间,我想提交一个 PR 给仓库不知道是否可以

mumuy commented 2 years ago

已增加