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

I am trying to show a notification message in IE11, But not working. Any other method is there for IE to show notification messages. If anyone knows please help to find the solution.

if(!("Notification" in window)){
console.log("Browser not supported");
}else if(Notification.permission === "granted"){
 console.log("Show content for New Message");
}
See Question&Answers more detail:os

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

1 Answer

An easy way would be to use alert() on older browsers, e.g.:

if(!("Notification" in window)){
   console.log("Browser not supported");
   alert("my message");
}else if(Notification.permission === "granted"){
   console.log("Show content for New Message");
};

Otherwise, if you're looking for better UX than that, you could write the message to the page.

It would also be a reasonable decision to only use the feature where it is supported. People using IE are unlikely to expect notifications from their browser!


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