Reputation: 1695
I want to clear browser cache in each page when it loads in the browser. I used clearcache() php function but it did not work for me. please help.
Thanks.
Upvotes: 2
Views: 20505
Reputation: 3557
Using php you can put this code to your head section of website:
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
Upvotes: 4
Reputation: 1161
Try this meta tag
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE" />
Thanks
Upvotes: 2
Reputation: 6114
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
//header("Content-Type: application/xml; charset=utf-8");
for clearing browser cache
Upvotes: 5
Reputation: 6968
Set the expires header to a past date. It will only be relevant for "clearing the cache" of a particular page..... if the browser wants to. Theres little serverside code can force on the client when it comes to this sort of stuff. It can basically only make recommendations.
Upvotes: 2
Reputation: 14155
Unfortunately you cannot clear the whole browser cache using php :(
Upvotes: 1