2016-09-15 211 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,至少現在還沒有。你最多可以做的是在標題,描述和操作按鈕中使用表情符號和圖標,但是沒有任何瀏覽器具有此功能。