0

I have a problem with cache. When I visit my site I see the old topic until I hit ctl+f5 to update the page. Is there any way to prevent browser from storing cache?

I have used these meta:

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">

but same result

Alex Poole
  • 161,851
  • 8
  • 150
  • 257
  • If you're using firefox for your tests, you can always do "private browsing". For IE it's "InPrivate browsing". Opera "Private Tab". Adding headers explicitly is hindering performance and consuming user's bandwidth unnecessarily. – SparKot Oct 26 '12 at 11:05

1 Answers1

0

Use the following headers :

Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

More can be found here

Edit1: As mentioned further in the link, use these plain HTML tags between <head> and </head> and see if it works :

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
Community
  • 1
  • 1
soundswaste
  • 2,634
  • 3
  • 19
  • 39
  • where i put them between here ? – user1692901 Oct 26 '12 at 09:56
  • after using the code i get the same result, how can i use the first code 'php' not 'html' – user1692901 Oct 26 '12 at 15:44
  • First you have to make sure php is installed on the server/machine. Then enclose the first php code inside `` tags and save the file as **abc.php** instead of **abc.html** – soundswaste Oct 26 '12 at 17:17
  • right now i am working on the server and when i but the code between i get this error Parse error: syntax error, unexpected ':' in C:\AppServ\www\d\index.php on line 59 – user1692901 Oct 26 '12 at 18:05
  • sorry i want to say before i work on my site on the server i try it on localhost is it will the cause of this problem – user1692901 Oct 26 '12 at 18:38