2016-09-15 117 views
0

因此,我设法使用Google Project和Service Worker为Google Chrome实施了网络推送通知。自定义Web推送通知(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"}] 
})); 
}); 

回答

0

您不能添加HTML和CSS,至少现在还没有。你最多可以做的是在标题,描述和操作按钮中使用表情符号和图标,但是没有任何浏览器具有此功能。