Friday, April 17, 2009

Browser cached pages + override + refresh

This is one of those "just a quick note..."

There are pages in the web which are enabled to be "cached" on the browser and most browsers do cache these pages. But there are times when you want to refresh and get the "latest" copy on the server, at which times what I do normally is open up tools menu for the browser and do something like "clear browser cache". (One place where I normally do this is on the development svn server where the pages are cached, and after creating a branch/adding a directory etc, it doesn't show up.)

Here's a quick workaround to refresh the page and get the latest copy from the server overriding the local cached copy in the browser.
Just add some random parameters at the end of the page.
e.g. If I'm looking at http://www.abhisanoujam.blogspot.com/, what you type is http://www.abhisanoujam.blogspot.com/?a=b in the browser address bar.
This will make sure that your browser actually hits the server bringing back the latest. Don't use the same random parameters as it may as well end up being cached :)

For the non-geeks: Don't forget the ? mark before the random parameters...