How can I detect Internet Explorer (IE) and Microsoft Edge using JavaScript?

前端 未结 13 966
小鲜肉
小鲜肉 2020-11-30 02:57

I\'ve looked around a lot, and I understand that there\'s a lot of ways to detect internet explorer.

My problem is this: I have an area on my HTML document, that when

13条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 03:18

    First of all its not the Notepad++ problem for sure. Its your "String Matching problem"

    The common string throughout all IE version is MSIE Check out the various userAgent strings at http://www.useragentstring.com/pages/Internet%20Explorer/

    if(navigator.userAgent.indexOf("MSIE") != -1){
       alert('I am Internet Explorer!!');
    }
    

提交回复
热议问题