Reload the page on hitting back button

header("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); //Date in the past
header("Cache-Control: no-store, no-cache, must-revalidate"); //HTTP/1.1

This works for me on FF3.6, IE7, IE8, Chrome5 (when hitting browser’s back/forth button the page is always RELOADED)

Another solution is to send exactly the same headers sent by session_start() function, very similar to the ones above, but even more rich:

header("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); //Date in the past
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); //HTTP/1.1
header("Pragma: no-cache");

NOTE: also the order shown here is the SAME as the order sent by session_start() (you can test this with HttpFox addon for FF)

Leave a Comment