Oliver Joseph Ash

Full-stack web developer

When will the browser cache be used?

Did you know that browsers will vary their usage of cached items based on user action (e.g. refresh or clicking a link) and resource type (document or asset)?

I ran a little experiment to see how cache behaviour in Chrome varied for the various user actions I could think of: refreshes, hard refreshes, submitting a URL in the address bar, and navigating via a link.

My experiment contained two HTML pages, each with an expiry time so it can be cached by the browser, and each containing assets which also had expiry times for the same purpose. The code for my experiment can be seen on GitHub.

Cache expiry*Revalidation
Refresh – documentny
Refresh – assetsny
Hard refresh - documentnn
Hard refresh - assetsnn
Submit URL bar - documentny
Submit URL bar - assetsyy
Link navigation - documentyy
Link navigation - assetsyy

*The browser bypasses the browser cache for assets with valid cache expiry times by setting a request header of cache-control: max-age=0