0
votes

I have a PWA. I have wrapped the application as cordova application. But I see that Service worker is not getting registered. I get error "ServiceWorker registration failed: DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not supported."

I can see there are a few plugins for IOS that helps in registering the Service Worker. Is there a way to register the service worker in Android platform?

1

1 Answers

1
votes

Based from this thread, service worker only works in secure mode either in https or localhost. It doesn't work in local resources like file:// or http.

The error message indicates that your browser is refusing to use a resource because the origin is null - which happens often for local (file://) resources. service-worker.js is local - I'll bet this is why you're getting the cross origin resource issue