Is it possible to refresh the browser cached data when necessary via PHP code? I have a fairly complex web application and I am using browser caching to speed up loading time/performance of pages.
How can I retain the advantages of browser caching, but still have the browser refresh the files when necessary? There are two sets of files - some are library files which need not change, and some are local, which change infrequently. I need to clear the browser cache only for local files conditionally. Is that possible?
I have this code:
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");
And this clears entire cache; any pointers in this direction would be helpful.
try this,
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: private, no-store, no-cache, must-revalidate");
ini_set('session.cache_limiter', 'private');
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");