简体   繁体   中英

How to load a remote image, and then load it from cache

I'm trying to embed a snapcode on a page using their api: https://feelinsonice.appspot.com/web/deeplink/snapcode?username=USERNAME&size=200&type=PNG

The problem is that it limits requests so quickly that after just a few reloads, it returns a 429 error.

Is there a way to load it from the remote server on first load, and then from the user's cache on subsequent reloads? Ideally it would expire after a day or so and reload the cached version.

You could control caching with a manifest:

eg https://www.html5rocks.com/en/tutorials/appcache/beginner/ also on w3schools etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM