Can't find serviceWorker in navigator anymore
Serve your page over HTTPS or use localhost
. Service workers require a Secure Context.
(MDN page, Chromium page).
The value of window.isSecureContext
indicates whether [SecureContext]
features are visible or hidden. (This is true
on a file://
URL and the serviceWorker API will be visible, but it won't work, of course.)
If you are using a virtual host locally for a domain other than localhost, you can tell chrome to treat your custom domain as "secure".
In the addressbar: chrome://flags/#unsafely-treat-insecure-origin-as-secure
Then add your domain like http://my-local-dev-domain.test
Click enable and click the restart button.
Another reason might be running a browser in private-mode