Lewis
Lewis

Reputation: 14916

ServiceWorker source headers

navigator.serviceWorker.register('/service-worker.js');

How can I retrieve the /service-worker.js headers without initialising an extra AJAX request?

Upvotes: 1

Views: 157

Answers (1)

Brendan Ritchie
Brendan Ritchie

Reputation: 2345

There's nothing in the service worker spec that provides for this. You can get the url from the registration object, but I don't see anything about headers.

They are planning to add a special expiration header for service workers in the future, so maybe it will eventually make sense to expose headers on the registration as well.

Unless there's a non-service-worker-specific way to do this, I think you're out of luck.

Upvotes: 2

Related Questions