6

Is it possible to tell when a browser is retrieving a page from a cache?

I've thought that opening a new tab and directly browsing to the URL would make a fresh pull request from the server, but after testing (in which certain page tailorings weren't changing), it seems that this does not happen.

So is it possible to tell when a browser is pulling something from a cache versus pulling it straight from the web server?

Hennes
  • 65,142
Coldblackice
  • 5,894

1 Answers1

8

The way I usually tell is to hit CTRL+SHIFT+K, or otherwise open the web debugging console, and watch the "Net" requests as the page loads. If you pay attention to the status codes, you'll see something like

[15:15:26.059] GET http://www.example.com/index.html [HTTP/1.1 304 Not Modified 312ms]

when the cache is used, instead of the normal

[15:15:26.059] GET http://www.example.com/index.html [HTTP/1.1 200 OK 31ms]

And if you want to be really sure that you're not using the cache, hit CTRL+F5 when refreshing.

oKtosiTe
  • 9,588
  • Or it might simply show "from cache" when clicking around rather than using a page refresh. – Arjan Jul 01 '13 at 19:46
  • It doesn't quite work for json responses for some reason(with max-age rather than last modified headers) the only giveaway kind of is the response time there. Unless I am missing something – Joe Yahchouchi Oct 19 '17 at 20:27