我有这个服务工作人员很好地接收Chrome的通知, ,但它没有与Firefox接收。谷歌云消息传递(GCM)不能与火狐工作
推送侦听器未在Firefox解雇所有(由调试它),
PS:服务工作者注册成功,但它没有收到通知。
我的代码有什么问题?
self.addEventListener('install', function (event) {
event.waitUntil(self.skipWaiting());
});
self.addEventListener('activate', function (event) {
console.log('Activated', event);
});
self.addEventListener('push', function (event) {
event.waitUntil(
fetch('/path', {
credentials: 'include',
method: 'post',
})
.then(function (response) {
return response.json()
.then(function (data) {
return self.registration.showNotification(data.title, {
body: data.body,
icon: '/images/image.png',
});
});
})
.catch(function (error) {
console.error('wrong', error);
})
);
});
感谢您的回答,但我正在使用google gcm文档进行通知,并且希望将其与Firefox集成。 https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=zh-CN –