Can't find serviceWorker in navigator anymore
Serve your page over HTTPS or use localhost
. Service workers require a Secure Context.
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.
Go to your vscode settings in the user>Extension option scroll down to live server config
set your host to localhost --ScreenShotSet host to local host
Now scroll down and uncheck use local IP option -- ScreenShot uncheck localIP
go to your Port json setting and set the port to 8080 --ScreenShot json settingset port to 8080Go live and check console