3

On a former project I was working on there was a manifest.json file while allowed the app to be a progressive web application.

However even now on different projects I can see that my browser is requesting the service-worker.js file from the backend ie:

GET /service-worker.js 404 557.926 ms

How can I turn this off within my browser so I don't see these errant logs come through my app?

Paolo
  • 20,112
  • 21
  • 72
  • 113
Anthony
  • 13,434
  • 14
  • 60
  • 80

1 Answers1

3

You need to unregister the service worker like such:

https://www.codementor.io/@himank/how-to-unregister-service-workers-n8mzf5jce

In case the link should stop working, these are the steps for Chrome.

  1. open the dev console
  2. click "Application" tab
  3. click "Service Workers"
  4. click "Unregister"

enter image description here

Paolo
  • 20,112
  • 21
  • 72
  • 113
Anthony
  • 13,434
  • 14
  • 60
  • 80
  • Any chances you'd know how a web server can inform the browser there's no point even trying to make a request towards /service-workers.js to begin with, regardless of client configuration? There's got to be an HTTP header that can be sent in the former HTTP response saying "hey, so this server is not using service workers so don't even bother"? – Crono Sep 02 '22 at 20:35