Forum Moderators: phranque

Message Too Old, No Replies

Preventing a page from being cached.

         

mmmwowmmm

9:57 pm on Nov 30, 2005 (gmt 0)

10+ Year Member



I am trying to keep some of my pages from being cached in the users browser. It was my understanding that you could disallow cacheing with the metatags:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">

yet that does not seem to work. Does anyone know why, or another way to prevent cacheing?

Thanks

Pfui

8:05 am on Dec 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It may have to do with your two hyphenated "no-cache" references. Try this instead:

<META HTTP-EQUIV="Cache-Control" CONTENT="no cache">
<META HTTP-EQUIV="Pragma" CONTENT="no cache">
<META HTTP-EQUIV="Expires" CONTENT="0">

(Mine are all on the same line but I think that's more preference than efficacy.)

A handy way to test is to include an autorefresh to another page in the same directory. Place the following after the above tags (still in the HEAD section):

<meta http-equiv="refresh" content="2; URL=real-page-here.html">

When you go to your first URL (the page with cache controls), then get redirected to your second (after two seconds), you shouldn't be able to go back.