javascript 所有浏览器的通知

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31684804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 14:10:46  来源:igfitidea点击:

Notifications across all browsers

javascripthtmlbrowsernotificationsweb-notifications

提问by Get Otter Here

Are there any sort of notification system that works with all major browsers? I know chrome has their Notification API, Safari has push notifications and IE has pinned sites but is there some more general way to show notifications? I did find https://github.com/ttsvetko/HTML5-Desktop-Notificationswhich uses a combination of different notifications (though I still can't seem to get the demo working in IE).

是否有任何类型的通知系统适用于所有主要浏览器?我知道 chrome 有他们的通知 API,Safari 有推送通知,IE 有固定网站,但有没有更通用的方式来显示通知?我确实找到了https://github.com/ttsvetko/HTML5-Desktop-Notifications,它使用了不同通知的组合(尽管我似乎仍然无法在 IE 中运行演示)。

回答by sideshowbarker

Are there any sort of notification system that works with all major browsers?

是否有任何类型的通知系统适用于所有主要浏览器?

The mechanism defined at https://notifications.spec.whatwg.org/is the only standard notification system for web applications that's intended to work the same across all browsers. It's supported in all current major browsers: Firefox, Safari, Chrome, and all other Chrome-based browsers.

https://notifications.spec.whatwg.org/ 中定义的机制是用于 Web 应用程序的唯一标准通知系统,旨在在所有浏览器上工作相同。当前所有主要浏览器都支持它:Firefox、Safari、Chrome 和所有其他基于 Chrome 的浏览器。

https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API

https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API