How can I target only Internet Explorer 11 with JavaScript?

后端 未结 7 2344
一个人的身影
一个人的身影 2020-11-27 03:23

What\'s the least error-prone way to target just IE11 with JavaScript?

Note: This should really only be done for analytics or informing the user what browser they\'r

7条回答
  •  攒了一身酷
    2020-11-27 03:56

    var isIE11 = !!navigator.userAgent.match(/Trident\/7.0; rv 11/);
    

    Source: http://www.nczonline.net/blog/2013/07/02/internet-explorer-11-dont-call-me-ie/

提交回复
热议问题