【问题标题】:Customizing Web Push Notification (Google Chrome)自定义 Web 推送通知 (Google Chrome)
【发布时间】:2016-09-15 10:10:20
【问题描述】:

所以我设法使用 Google Project 和 Service Worker 为 Google Chrome 实现了网络推送通知。

我的问题是如何自定义或装饰推送通知,因为消息框很简单。相反,我想用 html 和 css 来装饰它。

 self.addEventListener('push', function(event) {
 console.log('Push message received', event);
 var title = 'Push message';
 event.waitUntil(
 self.registration.showNotification(title, {
 body: 'Please choose to like or reply      
  icon: 'images/icon.png',
  tag: 'my-tag',
  actions:[
     {action:"like", title: "Like"},
     {action:"reply", title: "⤻ Reply"}]
}));
});

【问题讨论】:

    标签: javascript html css google-chrome push-notification


    【解决方案1】:

    您不能添加 HTML 和 CSS,至少现在还不能。您最多只能在标题、描述和操作按钮中使用表情符号和图标,但目前还没有浏览器具有此功能。

    【讨论】:

    • 我很好奇这方面是否有任何更新,因为它已经接近三年了。我没有在谷歌的网站上看到任何东西,但也许我只是缺少一些东西?
    猜你喜欢
    • 2015-12-20
    • 1970-01-01
    • 2017-06-01
    • 2020-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多