Google Chrome’s caching woes

We’ve run into an issue with Google’s Chrome browser while working on a new feature on one of our internal projects. It turns out Google’s famous and popular browser Chrome caches javascript and css files quote aggressively and would not refresh the cache even when adding an additional random parameter such as in the example below:

<script type="text/javascript" src="/js/some-javascript-file.js?nocache=12345678"></script>
What worked for us is a solution we found in this discussion on Chromium’s issues list:

<meta http-equiv="cache-control" content="no-store, no-cache, must-revalidate" />
<meta http-equiv="Pragma" content="no-store, no-cache" />
<meta http-equiv="Expires" content="0" />

Just add these tags to your website’s html head section and you should be good to go.

 

Leave a comment