3

I am working on an app for museum visitors that shows multi media information about the objects of some expositions. An example could be the info page for the Mona Lisa of the Da Vinci exposition.

The app is realized as a PWA to enable offline usage. Currently I am using workbox to precache the app shell. GET requests for REST resources are cached as well. This allows the user to reload the Mona Lisa page after going offline, but the app fails on pages that haven't been loaded before.

A solution would be precaching all the content together with the app shell. But then, expositions that are not interesting to the user would be downloaded as well. Instead, the user should be able to download the "exposition packages" of his choice.

Now, I wonder how to implement my "Download Exposition" button:

  • Leverage workbox's route requests [1] for caching and GET all resources in the background
  • Cache the GET requests manually using the Cache API
  • Introduce a local database that mirrors the online database. Fill it with the respective GET responses when clicking "Download"

Would you recommend the workbox, the Cache API or the DB approach? Or is there a standard solution I'm overlooking?

[1] https://developers.google.com/web/tools/workbox/guides/route-requests

Tobias Uhmann
  • 2,757
  • 2
  • 25
  • 35
  • Which approach did you choose? – Rafa Soler Sep 28 '21 at 14:14
  • @RafaSoler The replicated database approach seemed the most promising. During my research, I came across Pouchdb, a JavaScript implementation of CouchDB that allows keeping an automatically synchronized duplicate of my document database in the browser. However, due to changing infrastructure requirements, I didn't pursue this approach to production maturity - but I'd start there again if I had to. – Tobias Uhmann Sep 30 '21 at 12:46

0 Answers0