Re: Web Publications via HTML Imports

Hello Benjamin,

Using prefetch/preload is not enough for your "keep" use case.

If the resources that you prefetch (most of the time you'll want to use
prefetch and not preload) use Cache-Control with specific settings (let's
say that the resource is cached for a week), they might work offline.
But if they rely on other cache directives or you force reload the
resource, your browser will attempt to revalidate (make a network request)
these resources and will eventually fail to display them in an offline
context.

To truly store them offline you'll need:

   - to have a registered Service Worker that will intercept the network
   request
   - make sure that you have previously stored in cache these resources (it
   doesn't have to be the responsability of the Service Worker itself)
   - and also that a proper network policy is applied (cache first for
   example) on the URLs that you're working with

In these kind of situations, caching, prefetch/preload, Service Workers and
caching all work hand in hand together, but you can't truly replace one
with the other.

Best,
Hadrien

Received on Tuesday, 1 August 2017 17:04:40 UTC