NodeJS 安装在我的服务器上。
我在 Drupal 8 站点上安装并配置了以下 4 个模块。当我看到带有“私有(private)消息使者”的消息时,我会收到“jGrowl”通知。
https://www.drupal.org/project/private_message
https://github.com/jez500/Private-Message-Messenger
https://github.com/jez500/Private-Message-NodeJS
https://www.drupal.org/project/nodejs
我的问题:
如何在桌面网络浏览器(chrome、firefox...)上创建通知?
这是即时通讯工具:
目前,当用户收到消息时,他会在我的网站上收到通知。问题是,如果用户不在我网站的页面上,他将看不到他已收到通知。
示例:
我有一个 nextcloud 消息传递。如果我在另一个页面上并收到一条新消息,nextcloud 会在 Firefox 上发送一条通知(声音和视觉)(在我的例子中,我在 ubuntu 通知中心收到它)。
如何在我的网站上执行此操作?
最佳答案
使用 Service Worker 将通知添加到 Chrome 和 Firefox 等浏览器中。查看Push messaging sample for chrome.
另请参阅 web push Notifications 上的这篇文章
关于javascript - 如何在桌面网络浏览器(chrome、firefox...)上创建通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49351192/