Here’s what I’m trying to accomplish:
- Load an image from a remote server
- Save the image’s base64 data to localStorage
- On the next request, if the localStorage item exists, load the image from localStorage data
This is in an attempt to strive for the fewest number of API calls – the image is a dynamically generated QR code via API call, so converting into a Base64 string before deployment is not an option here.
Thanks!
If you really want to have a bit more control over caching (besides setting expiry settings on the server), have a look on how to use HTML5’s ApplicationCache. Here’s a compatibility table for supported browsers.