简体   繁体   中英

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

AFAIK the only difference between IE11 on Windows 8.1 and Windows 10 is the removal of 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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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