How do you stop a users' browser from caching pages from your site. There is no 100% method of doing this. As a website developer or webmaster, you have to assume for the worst (i.e. that a user is viewing a cached version of your pages) and make sure that you handle it on the next page request.
There are two methods to minimize the chance that a user is viewing a cached version of a page on your site.
These two approaches can also be used together.
Add an onload action that checks to see if this is a cached page or not. If cached version, redirect. The redirect can be implented in various ways. A meta refresh that needs to be canceled by javascript. Change window.location. A simple test to see if a page is cached or not is to include a timestamp in the page.
If a user has javascript turned off in their browser, the javascript check will not execute.
These are commands that are returned to before the content of the page. All standards compliant browsers read through the commands which can affect how the page is loaded, stored, ... The following commands will tell the browser that it should not cache the page.
In perl:
print "Cache-Control: no-cache, no-store\n";
In php:
header("Cache-Control: no-cache, no-store");
With meta tags:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE, NO-STORE">
Browsers can be configured to ignore these headers. Beware if your webserver is behind a proxy. Some proxies are not configured correctly and will not pass the response headers correctly.
UsableLayout is a website design and development company. We are available for consultation and development of website cache control mechanisms and many other website development services.