How do I detect IE and Edge browser?

前端 未结 3 700
难免孤独
难免孤独 2020-12-13 19:01

Can\'t get Parallax working properly in IE or Microsoft Edge. I\'ve looked in forums and haven\'t found a solution to the problem. I\'ve come up with hopefully a solution fo

3条回答
  •  青春惊慌失措
    2020-12-13 19:58

    For me better this:

    var uA = window.navigator.userAgent,
        isIE = /msie\s|trident\/|edge\//i.test(uA) && !!(document.uniqueID || document.documentMode || window.ActiveXObject || window.MSInputMethodContext),
        checkVersion = (isIE && +(/(edge\/|rv:|msie\s)([\d.]+)/i.exec(uA)[2])) || NaN;
    

    Go run: http://jsfiddle.net/Webnewbie/apa1nvu8/

提交回复
热议问题