Skip to content
Browser cache invalidation with Javascript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


# Author: Rogério Carvalho Schneider <>
# URL:

Invalidates browser's cache for a given page based on the last refresh.

- Include in the HEAD of your page and set the TTL

     <script src="http://your_site/javascripts/querystring.js" type="text/javascript"></script>
     <script src="http://your_site/javascripts/cache_invalidation.js" type="text/javascript"></script>



- And set the TTL you want into the cache_invalidation.js file:
    // TTL: set your cache threshold here
    var ttl = 300;  // seconds

The querystring.js component I got from Adam Vandenberg:

See also for a complete explanation on how it works and why:
You can’t perform that action at this time.