3 ms·
I seem to remember trying this (passing {scope:'/'} in the register call), and it doesn't work. Some googling seems to agree: "Service Workers are restricted b
by joev_ 11y ago
I seem to remember trying this (passing {scope:'/'} in the register call), and it doesn't work. Some googling seems to agree:
"Service Workers are restricted by the path of the Service Worker script unless the Service-Worker-Scope: header is set" [1]
I do wish the spec required a 'Content-type: text/service-worker', as that would effectively eliminate accidental ServiceWorkers as a threat.
[1] https://infrequently.org/2014/12/psa-service-workers-are-coming/ https://infrequently.org/2014/12/psa-service-workers-are-com...
- comex 11y agoHmm; I don't see that in the current spec [1], and that link is pretty old. I should test it. https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html https://slightlyoff.github.io/ServiceWorker/spec/service_wor...