Reputation: 1111
The issue is, every browser used to store cache of webpages, and whenever I update my webpage from the server, I can not see the updating until I perform refreshing of that page or clear the cache. So, this is a big problem for users/guests, for example, the visitor visits my webpage today, and I update my webpage that has important news, Whenever he will visit again, he will be unable to see the updating due to already stored cache on his/her system. Until he/she refresh the page or clear cache of the browser, the updating will be hidden.
Is there any solution of this issue ? because mostly no body used to refresh the page or good at clearing the cache. So, any idea how to solve it?
or If I am not wrong, can I do that when the visitor leaves my webpage, the cache of only my webpage deleted/cleared. Any php code, script or anything ?
Thanks.
Upvotes: 1
Views: 508
Reputation: 4798
Using PHP :
if( !headers_sent() )
{ header('Expires: ' . gmdate('D, d M Y H:i:s') . 'GMT');
header('Cache-control: no-cache');
}
Using HTML :
<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">
You can't clean clients cache but you can make it expire at specific time.
Upvotes: 2