[英]After accepting web notifications, can a website send notifications when browser has no tab open of this website?
I am reading the Web notification API and I want to send notification like they are on iOS or Android (ex: You have 7 new messages
).
考虑到我已经接受了来自www.my-foobar-super-site.com
通知,我可以在授权通知后,当该用户没有打开该网站的标签时,我的网站可以向用户发送 Web 通知吗?
接受web通知后,网站在浏览器没有打开该网站的标签时可以发送通知吗?
是的,但它不仅仅是授予通知权限的用户。
Web 通知 API 只关心在屏幕上显示来自用户计算机上已经运行的脚本的消息,它与“推送通知”或传递无关。
要将“推送”消息发送到用户的浏览器,您需要使用单独的 Push API - 并运行 Service Worker 以从您的服务接收消息(通过 Push API),然后您的脚本才能使用通知 API 来显示通知消息。
可以,只要您注册了 Service Worker。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.