在Chrome或Firefox中从封闭的网络应用程序发送桌面通知? [英] Send desktop notifications in Chrome or Firefox from a closed web app?

查看:201
本文介绍了在Chrome或Firefox中从封闭的网络应用程序发送桌面通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是在Chrome中发送 Gmail风格的桌面通知或Firefox浏览器中的Web应用程序(我们称之为X),而不需要用户安装应用程序或扩展程序。如果用户需要授予接收来自X的通知的权限,那么可以,只要不需要在浏览器中打开X,浏览器需要打开以显示通知即可。一个不需要任何浏览器窗口的解决方案也是可行的。



我只是花了一天的时间来研究这个问题,到目前为止我认为我了解到:


  • 从OSX Mavericks开始,Safari 7+可以通过 Safari推送通知
  • Twitter 发送类似的网络通知,而不用先询问用户的权限,但要求用户的浏览器对Twitter开放。

  • 有很多引用可能


我上面的任何一个陈述都可能是错误的 - d爱听到它!我也愿意接受任何其他解决方案。任何想法?



感谢您阅读。 您可以发送即使您的网页未处于活动状态,也可以使用服务人员推送通知,服务人员的通知API 推送API 以获取服务器启动的通知(或计划通知)。



截至2016年6月,Chrome,Firefox和Opera均支持服务人员。请参阅 https://jakearchibald.github.io/isserviceworkerready/ 中的状态。



请参阅下面的链接以获取相关讨论,实施状态和规范。




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 user to install an app or extension. It's okay if the user needs to grant permission to receive notifications from X, and it's okay if the browser needs to be open for the notification to appear, as long as X doesn't need to be open in the browser. A solution that doesn't require any browser window to be open would also work.

I just spent the day digging into this, and so far I think I've learned:

  • Since OSX Mavericks, it has been possible to do this in Safari 7+ via Safari Push Notifications.
  • The Web Notifications API works in Chrome/Firefox, but requires the user's browser to be open to X.
  • Twitter sends similar web notifications without asking the user for permission first, but requires the user's browser to be open to Twitter.
  • There are lots of references to possible Growl implementations, but as far as I can tell, all of them require the user to install Growl and/or a Growl-enabled app to work.

I could be wrong about any of my statements above - I'd love to hear it! - and I'm open to any other solution too. Any ideas?

Thanks for reading.

解决方案

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.

这篇关于在Chrome或Firefox中从封闭的网络应用程序发送桌面通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆