-
Notifications
You must be signed in to change notification settings - Fork 42
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
Gate background fetch on user activation #143
Comments
https://auto-large-download-test.glitch.me - this site starts a download without user interaction. In Safari this shows a permission dialog, which is the pattern I was trying to enable in the bgfetch spec. Although calling I did this, rather than use an actual permission prompt, so the download could be 'accepted' even after the user has navigated away from the site.
I was hoping to enable this. Eg, a podcast app could start a download in response to a push message. Again, the download could start in a paused state, requiring user interaction to unpause. The UA could offer options like "always let this site perform background downloads", and "never let this site perform background downloads". The spec allows UAs to unpause/reject background fetches on behalf of the user. It also allows UAs to pause downloads if a situation changes that means the download should wait, or require extra confirmation (eg, the user moves onto a metered connection). If the above is acceptable, I'm happy to try and make it clearer in the spec. |
Whenever there is UI being shown to the user, it is best to tie it to a context that makes sense to the user.
I would guess something like the following could be done:
It seems you are trying to offer more, in particular in the case where user really trusts the web page and has changed some settings so that the web page is allowed to download in the background. |
That, but also the ability to accept the download without having to spin up a page or service worker. Chrome currently puts download requests in the downloads tray on desktop, and as a notification on mobile. Neither are attached to a page. Safari does a mix: The permission is part of the page, but the download has started in a paused state. I guess we could add something to the spec to say the browser can reject the fetch if there's no meaningful place to ask the user. |
Not really, the download has not started at all. In general, meaningfully prompting the user from a background process is hard. That is the tricky part of supporting bgfetch in service workers. The path seems much clearer on windows. |
Right, I mean there's UI for it in the downloads section of the browser. This is what I mean by "started in a paused state" - the bgfetch spec uses this in the same way. The download hasn't actually started, but from a UI perspective it can look like it's in a paused state.
On mobile it doesn't seem too bad, no? You'd get a notification like "podcast.example.com wants to start a download block / allow". |
If we leave the case of service worker calling bgfetch and concentrate on the window case, is there consensus to put a user activation requirement there? |
I don't see why we'd make that a requirement, given that regular downloads don't have that requirement and they're more powerful, since they write straight to a user directory, and don't have CORS restrictions. |
For downloads, this requirement is probably not web compatible anymore. An example is getUserMedia vs. getDisplayMedia: the former has no such requirement (it shipped quite some time ago, and this is hard to enforce user activation) but the latter has that requirement. Let's look again at the 'start-a-download-in-a-background-page' scenario:
These issues can probably be solved but they are nonetheless difficult to handle properly. |
https://wicg.github.io/background-fetch/#background-fetch-manager-fetch is executing a 'display ' step which might trigger prompting the user. User activation is generally a requirement in those flows. This would also mirror well the desired behavior for downloads.
This would also for instance resolve the case of a backgrounded page trying to start a background fetch.
The text was updated successfully, but these errors were encountered: