Send desktop notifications in Chrome or Firefox from a closed web app?

后端 未结 2 634
南方客
南方客 2020-11-30 18:20

My goal is to send Gmail-style desktop notifications in Chrome or Firefox from a web app (let\'s call it X) that is NOT currently open in the browser, without requiring the

2条回答
  •  旧时难觅i
    2020-11-30 18:41

    You can send push notifications even when your web page is not active using Service Workers, the Notification API for service workers and the push API for server-initiated notifications (or scheduled notifications).

    As of June 2016, Service Workers are supported in Chrome, Firefox and Opera. See the status at https://jakearchibald.github.io/isserviceworkerready/

    See the following links for related discussions, status of implementation and specifications.

    • Service workers are enabled by default since Chrome 40, Firefox 33, and Opera 24. See the HTML5Rocks tutorial and MDN.
    • Push notifications: Chrome 42+, Firefox 44+

提交回复
热议问题