This is a question about browsers in general, but I'm primarily concerned with Chrome.
Let's say I have the following snippet in a file, index.html:
<img src='//path/to/foo.img'></img>
and foo.img
changes on my server every hour. I want to prefetch this image on the hour so that when the user refreshes the page, the updated image //path/to/foo.img
is read from the browser's HTTP cache.
There are a few things I'm uncertain about:
- Are the responses for XHRs cached at all by default?
- If so, do they use a separate cache from the one the browser uses when fetching things like img, css, js, etc. requests?
- If the answer to #2 is no, then is it sufficient to send an XHR for
//path/to/foo.img
in order to cause the response to be cached - and then re-used by the browser when the page is refreshed?