A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Proposal] Add a manifest key for sites that ‘provide meaningful offline content’

owencmoore
2017-01-20

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 providesMeaningfulOfflineContent, where 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.

kenchris
2017-01-20

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 :slight_smile: Also manifest uses underscores, like "provides_meaningful_offline_content".

It could possible be a sub entry of the "serviceworker" like

"serviceworker": {
  "src": "sw.js",
  "scope": "/foo",
  "use_cache": false,
  "provides_meaningful_offline_content": true
}
DanielHerr
2017-01-20

works_offline is a better name.

owencmoore
2017-01-21

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?

DanielHerr
2017-01-21

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.

kenchris
2017-01-21

You could do something like "usefulness_offline": "fully" (say for a calculator), | "basic" | …

Tigt
2017-01-26

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.