Pouchdb: Website: Precache documentation / guides

Created on 21 Dec 2016  路  6Comments  路  Source: pouchdb/pouchdb

Currently our website uses _both_ Service Worker and AppCache, which is kind of silly. Furthermore, the service worker works as a "try network, then cache" mode which means that it doesn't fullfill the same function as聽Service Worker because it doesn't cache the whole site offline.

I would recommend either removing App Cache entirely or making it a fallback. We can use something like appcache-nanny to provide programmatic access to appcache (under the hood, it works by creating聽an iframe) and then removing the appcache reference from index.html. We could also use something like聽sw-toolbox to simplify our current approach; I would like us to just pre-cache all content except maybe for images.

All 6 comments

I think we changed the Service Worker to that behaviour because caching the whole site was unreasonable for the amount of pages we have, but maybe the file size is not too big.

The big problem with that from an appcache point of view was that if it failed halfway through nothing happened of course but this can be avoided with SW.

Just thinking about people's data plans etc.

My understanding was that if both AppCache and ServiceWorker were used and a browser supported both then AppCache would be ignored. Is this not the case generally?

From Using Service Workers:

if you use AppCache and SW on a page, browsers that don鈥檛 support SW but do support AppCache will use that, and browsers that support both will ignore the AppCache and let SW take over.

Yup I tested that when the patch landed, appcache is being used as a fallback right now, they arent both being done at the same time.

Nick and I discussed the change in behaviour of prefetching vs caching when this landed, I think we could do with prefetching a few more things, the API and the mostly static docs and maybe just the first 5 blog posts?

Yup I tested that when the patch landed, appcache is being used as a fallback right now, they arent both being done at the same time.

My bad! Yeah I'm fine with increasing the precached docs or even just keeping it the same. I thought it was a mistake.

I can see the API docs and the Guides especially being useful precached, I often open a tab for a tutorial before say getting on a train and going through it but we dont need to gather every blog post ever written and we probably need to change the logic so that if a guide page does fail to download it doesnt invalidate the entire service worker

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DiamondYuan picture DiamondYuan  路  4Comments

nolanlawson picture nolanlawson  路  6Comments

xub picture xub  路  4Comments

gr2m picture gr2m  路  5Comments

mikkokam picture mikkokam  路  6Comments