Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 for now. I want to make a message appear if the user is using IE or Edge. Not sure how I can detect that the browser being used is one or the either.

Here is some javascript code I'm trying to work with:

<script src="https://github.com/ded/bowser/blob/master/src/bowser.js"></script>

    // Determine Browser Used
browser = require('bowser').browser; becomes browser = require('bowser');
if (bowser.msie || bowser.msedge) {
  alert('Hello Microsoft User');
}

Any help would be appreciated or if there is a better solution.

http://peaceandplentyinn.mybnbwebsite.com

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
544 views
Welcome To Ask or Share your Answers For Others

1 Answer

I doubt you really need to detect the browser. But here it is anyway (don't really need to use a library):

// detect IE8 and above, and edge
if (document.documentMode || /Edge/.test(navigator.userAgent)) {
    alert('Hello Microsoft User!');
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...