Chrome Web App with A Lot of Images How to Download and Store?

74 Views Asked by At

What is the best way to create a chrome web app and have about 300-400MB of images download initially on load to a local storage and then be able to retrieve those images at any time in my app.

I want my app to look at local storage first, and if images exist use those images and if they don't then download from an online repository. My app can have upwards of over 1000 images and I don't want to code individual XMLHTTPRequests for each image.

1

There are 1 best solutions below

0
On

You're looking for ServiceWorker. This API will allow you to implement a cache for various URLs on your website and to prefetch/predownload these URLs. You will probably want to use the newer Cache API, however, to do this rather than storing the downloaded images in localStorage.