最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - chrome extension with service worker receiving push notifications - Stack Overflow

programmeradmin3浏览0评论

I've successfully built a service worker that receives push notifications following this tutorial.

And I was trying to build a chrome extension that would allow me to subcripe to the push notifications. But it seems that when the extension runs the service worker is not supported.

Service Worker Error :^( DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('chrome-extension://dghajjpcbhcpnnkkgehjhhceemhcacoc') is not supported.

Am I missing some permissions on the manifest.js?

I followed this tutorial for the Chrome extension.

I've successfully built a service worker that receives push notifications following this tutorial.

And I was trying to build a chrome extension that would allow me to subcripe to the push notifications. But it seems that when the extension runs the service worker is not supported.

Service Worker Error :^( DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('chrome-extension://dghajjpcbhcpnnkkgehjhhceemhcacoc') is not supported.

Am I missing some permissions on the manifest.js?

I followed this tutorial for the Chrome extension.

Share Improve this question asked Feb 29, 2016 at 12:27 TxugoTxugo 5,0785 gold badges36 silver badges41 bronze badges 3
  • using this for ref: github./googlesamples/gcm-playground/tree/master/chrome – Txugo Commented Feb 29, 2016 at 15:27
  • 1 Have you found a solution or tutorial to this (with the service worker)? I'm facing the same problem – MatPag Commented Jun 24, 2017 at 11:04
  • 1 See newer post here: stackoverflow./q/41350291/632951 – Pacerier Commented Sep 17, 2017 at 19:25
Add a ment  | 

1 Answer 1

Reset to default 8

Enabling Service Workers for Chrome extensions is still a work in progress. You can track it here. It seems that it is already available in the Canary and Dev channels.

You don't need a Service Worker to be able to receive push notifications in a Chrome extension. You can use the chrome.gcm API.

发布评论

评论列表(0)

  1. 暂无评论