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

Should web pages without service workers be able to use bgfetch? #148

Open
youennf opened this issue Apr 29, 2020 · 1 comment
Open

Should web pages without service workers be able to use bgfetch? #148

youennf opened this issue Apr 29, 2020 · 1 comment

Comments

@youennf
Copy link

youennf commented Apr 29, 2020

(Note: I know this is a big departure from the current model of bgfetch).

I am curious if there is any interest in allowing pages to use bgfetch without having to register any service worker.

It seems that, ideally, we would have a layered model where bgfetch would allow basic functionality if service worker is not used/available, and advanced functionality if service worker is used.

@jakearchibald
Copy link
Collaborator

The reason this depends on SW is to provide a standard place to handle the events.

What's the alternative? If you fire them in a page, then you run the risk of dispatching them on a page without the correct event handler, which could happen for a load of reasons:

  • Script containing the listener fails to load.
  • User navigates to an HTTP 500, which doesn't have the script with the listener.
  • User closes the page before the results of the bgfetch are written somewhere long-term.
  • Developer forgot to put the listener on a particular page of their site.

I guess the system could write directly to some form of storage, which might work in some cases, but that was discussed in #3.

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