Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take control over the very first page #938

Closed
lewispham opened this issue Aug 1, 2016 · 1 comment
Closed

Take control over the very first page #938

lewispham opened this issue Aug 1, 2016 · 1 comment

Comments

@lewispham
Copy link

At this time, ServiceWorker simply ignores the very first page that registers it. It should take control over this page right after it is activated. It doesn't make sense to ignore requests fetched after ServiceWorker is ready to work.

I think it's best to activate ServiceWorker before all. In order to achieve that, it should be able to be registered via http headers instead of Javascript.

@jakearchibald
Copy link
Contributor

It should take control over this page right after it is activated

This wouldn't make sense as the default, but the activated SW can call clients.claim() to take control of pages.

it should be able to be registered via http headers instead of Javascript.

It already can https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#link-type-serviceworker, however it doesn't block the page while the service worker installs.

Blocking the page would create a huge drop in performance, as your first render is gated on everything in the install step. Instead, we're encouraging a more progressive (and faster) model.

If you must, you could serve a loading page from the server, then refresh it once the service worker installs. But again, this creates a much slower user experience so we don't recommend it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants