I have a question regarding browsers in general, with a focus on Chrome.
Imagine I have the following code snippet in my file, index.html:
<img src='//path/to/foo.img'></img>
The file foo.img
changes on my server every hour. I would like to prefetch this image on the hour so that when a user refreshes the page, the updated image //path/to/foo.img
is loaded from the browser's HTTP cache.
I have a few uncertainties:
- Are XHR responses cached by default?
- If so, do they utilize a different cache than the one used for fetching img, css, js, etc. requests?
- If the answer to #2 is no, would it be enough to send an XHR for
//path/to/foo.img
to have the response cached and subsequently used by the browser upon page refresh?