简体   繁体   English

如何使用JavaScript在Windows 10上检测IE11?

[英]How to detect IE11 on Windows 10 in javascript?

  • it shouldn't depend on an easily spoofable method 它不应该依赖于容易欺骗的方法 (eg user agent) (例如用户代理)
  • it shouldn't be picked up by earlier versions of Windows Windows的早期版本不应该使用它

AFAIK the only difference between IE11 on Windows 8.1 and Windows 10 is the removal of P3P. AFAIK Windows 8.1和Windows 10上的IE11之间唯一的区别是删除了P3P。
Are there any other changes/unfixed bugs that could be used to detect it? 还有其他可用于检测它的更改/未修复的错误吗?
Something like the IE11 on Windows 7 guide—but for Windows 10—would be quite useful in that endeavour. 诸如Windows 7上IE11指南(但适用于Windows 10)之类的东西在此方面将非常有用。

Here's how I did it: 这是我的操作方式:

if (
     // is IE 11 even in web workers
     !self.ActiveXObject && 'ActiveXObject' in self &&

     // exclude Windows 7/8/8.1 and Windows Phone 8.1
     /Windows NT 10.0/.test(self.navigator.userAgent)
   )
   console.log('IE11 on Windows 10');

I have also read that HTTP/2 support is Windows 10 specific . 我还阅读到HTTP / 2支持特定于Windows 10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM