I am accessing a link on my site that will provide a new image each time it is accessed.
The issue I am running into is that if I try to load the image in the backgr
Simple solution: add this header to the response:
Cache-control: no-store
Why this works is clearly explained at this authoritative page: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
It also explains why no-cache
does not work.
Other answers do not work because:
Caching.delete
is about a new cache that you may create for off-line work, see: https://web.dev/cache-api-quick-guide/
Fragments using a # in the URL do not work because the # tells the browser to not send a request to the server.
A cache-buster with a random part added to the url works, but will also fill the browser cache. In my app, I wanted to download a 5 MB picture every few seconds from a web cam. It will take just an hour or less to completely freeze your pc. I still don't know why the browser cache is not limited to a reasonable max, but this is definitely a disadvantage.