When the user is offline the browser may want to show icons for sites that work offline thanks to Service Worker. Additionally, the browser may want to visually distinguish sites that work offline, for example via an offline badge.
I propose we add a key to the Manifest spec named something like
true indicates that if the user opens the PWA while offline, it will provide access to some content, or other useful functionality, as opposed to simply opening and showing no content as the user is offline.
The best way for browsers to build such a feature goal today is with heuristics like:
- Does the site have a service worker installed?
- Does the service worker have a fetch handler?
- Does the service worker respond to requests to the startURL with a 200 response?
But this is insufficient as many Progressive Web Apps cache the “shell” offline but no content and although the PWA can be opened when offline, there is nothing for the user to do. In these cases, telling the user “You’re offline! Why not try one of these?” with a list of options that only open and say “Not connected” is a poor experience.
Note that incentives are also aligned for developers to set
providesMeaningfulOfflineContent correctly, as they don’t stand to gain anything by being launched offline unless they provide some meaningful experience.
I think you should add to the heuristics that there should be a serviceworker in the manifest itself, especially as Microsoft will use this for brings PWAs to their store, so further encouragement for that would be good in the long run, ie. only actually show offline badge for sites with providesMeaningfulOfflineContent in case that the manifest additionally has a serviceworker in it.
I like the idea, but hope we can find a shorter name Also manifest uses underscores, like
It could possible be a sub entry of the
works_offline is a better name.
Good point about underscores @kenchris! Your suggested about nesting it under the sw section makes sense to me.
@DanielHerr - I’d like us to find something self documenting so developers will only set it to true if it provides some content offline, not just the shell. I can imagine a developer going "Yeah I have a SW,
works_offline: true", even if when the user opens it, the PWA just says “No connection”.
useful_offline is shorter and may get us a little closer to that?
useful_offline is basically equivalent to
works_offline. I also doubt anyone would interpret
works/useful_offline as including showing a no internet connection screen.
You could do something like
"usefulness_offline": "fully" (say for a calculator), |
"basic" | …
How would one combat sites that dishonestly include it to look better? I fear this is a social problem, not a technical one. Safari added
shrink-to-fit because many websites with
<meta name="viewport" content="width=device-width"> were doing so to appear mobile-friendly to Google. This could end similarly.