0

When testing for service worker capability in the browser:

(in index.html)

if ('serviceWorker' in navigator) {
    console.log('serviceWorker OK');
} else {
    console.log('serviceWorker NOT OK');
}

Now if I call localhost/index.html I get a positive result:

=> serviceWorker OK

Same when using loopback (127.0.0.1/index.html).

Now if I call mymachine.local/index.html suddenly the capability diseappears:

=> serviceWorker NOT OK

Is it an Avahi/Zeroconf restriction, or just a problem with my OS implementation?

yPhil
  • 8,049
  • 4
  • 57
  • 83
  • 1
    Service workers only run over HTTPS, for security reasons. During development you'll be able to use service worker through localhost, but to deploy it on a site you'll need to have HTTPS setup on your server. – hoangdv Apr 04 '19 at 08:19
  • You can get HTTPS working on your local development environment. – hoangdv Apr 04 '19 at 08:20

0 Answers0