Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chrome extension with service worker receiving push notifications

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.

like image 518
Txugo Avatar asked Feb 29 '16 12:02

Txugo


People also ask

Can Chrome extensions send notifications?

By default, Chrome alerts you whenever a website, app, or extension wants to send you notifications. You can change this setting at any time.

Which Chrome extension API function would be used to make a notification appear in the system tray?

Use the chrome. notifications API to create rich notifications using templates and show these notifications to users in the system tray.


1 Answers

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.

like image 180
rsanchez Avatar answered Sep 21 '22 20:09

rsanchez