I'm wondering if there is a way how to detect when a response is returned from a local cache? Is it possible?
The solution should be general and work for unconditional requests. In this case, the response code is always 200 OK, but XHR returns a cached resource for the second request (e.g. the first response contains Expires header, so there is no need to ask a server for a new resource before the expiration date).
The answer is Date header
e.g.