Showing posts with label cache. Show all posts
Showing posts with label cache. Show all posts

Thursday, 24 May 2018

Prevent caching using .htaccess

Sometimes your pages and scripts etc get cached forcing you to examine whether you really did save the file you're working on, or pressing ctrl-f5 to make sure you have the up to date version in your browser. To cut down on this confusion follow the instructions below.
cd myApp
touch .htaccess
Now add the following to the .htaccess file, which will prevent caching
<filesMatch "\.(html|js|css)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
Remember to remove this when you've finished developing.

Friday, 2 March 2012

Removing cache manifest in Chrome

In an earlier post, I explained how to use cache-manifest for localstorage. Once you've achieved this, you'll find that in order to continue editing the site that the cache manifest will need to be removed. Otherwise, you won't see your changes. To do this in Chrome, you need to put this command in the address bar:
This will list all the sites in your application cache with a 'remove' link.
A full list of such commands, enter chrome://chrome-urls/