Disable browser cache in PHP or JavaScript in a Flash application

A common practice to disable browser caching is to set an expiration to a date in the past in the HTTP header. Different browsers utilize HTTP header values differently so it is important to use many if not all of the following settings:

<?php
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>

Read more about the header function on the PHP website.

Leave a Comment