Issue with "ServiceWorkerContainer.register()": may be advisable to check for an existing registration #7138
Labels
area: Workers
Content:WebAPI
Web API docs
effort: medium
This task is a medium effort.
help wanted
If you know something about this topic, we would love your help!
MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register
What information was incorrect, unhelpful, or incomplete?
I assumed (wrongly) from this that registering an already-registered worker would be a no-op. It turns out that it at least causes a network request for the worker, and that request doesn't go via the cache even if you have
updateViaCache: 'all'
(which makes sense). So regardless of your update mode, not checking for an existing registration will cause extra server load.Specific section or headline?
What did you expect to see?
More detailed info about why I might want to check for an existing registration, even if I don't need to.
Did you test this? If so, how?
Yes, looking at request headers in Fiddler.
MDN Content page report details
en-us/web/api/serviceworkercontainer/register
The text was updated successfully, but these errors were encountered: