简体   繁体   English

接受web通知后,网站在浏览器没有打开该网站的标签时可以发送通知吗?

[英]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 ). 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 ).

Considering I have accepted notification from www.my-foobar-super-site.com , can I, after authorizing notification from it , can my website send Web notification to a user when this user has no tabs open of this website?考虑到我已经接受了来自www.my-foobar-super-site.com通知,我可以在授权通知后,当该用户没有打开该网站的标签时,我的网站可以向用户发送 Web 通知吗?

After accepting web notifications, can a website send notifications when browser has no tab open of this website?接受web通知后,网站在浏览器没有打开该网站的标签时可以发送通知吗?

Yes, but there's more to it than just a user granting the notifications permission.是的,但它不仅仅是授予通知权限的用户。

The Web Notifications API is only concerned with displaying messages on-screen from a script already running on the user's computer, it is unrelated to "push notifications" or delivery. Web 通知 API 只关心在屏幕上显示来自用户计算机上已经运行的脚本的消息,它与“推送通知”或传递无关。

To send "push" messages to a user's browser, you'll need to use the separate Push API - and run a Service Worker to receive messages from your service (via the Push API) and only then can your script use the Notifications API to show the notification message.要将“推送”消息发送到用户的浏览器,您需要使用单独的 Push API - 并运行 Service Worker 以从您的服务接收消息(通过 Push API),然后您的脚本才能使用通知 API 来显示通知消息。

Yes, as long as you have registered a service worker.可以,只要您注册了 Service Worker。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 浏览器通知调用了网站 - Browser notifications invoked website 网站通知 - Website notifications 我可以使用 Urban Airship 在我的网站上发送和接收推送通知吗? - Can I Send And Receive Push Notifications On My Website With Urban Airship? Chrome通知 - 魔力推送即使网站未打开也是如此 - Chrome Notifications - Magic Push even when the website is not open 服务工作者甚至不在网站上发送推送通知 - Service worker send push notifications even not on the website 打开新的浏览器选项卡时如何为不同的网站设置 cookie - How to set cookie for a different website when open new browser tab 接受 clevertap web 推送通知确认后,我很晚才收到基于浏览器的提示确认(允许或阻止通知) - After accepting clevertap web push notification confirmation I get browser based prompt confirmation (to allow or block the notifications) very late 如何检测当前网站上的推送通知是否被阻止? - How to detect if push notifications are blocked on current website? 从网站致电Windows 10桌面通知吗? - Call Windows 10 Desktop Notifications from a website? 接收来自 Twitter 的通知到我的网站 - Receive notifications from Twitter to my website
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM