1

i've already be added the following lines to prevent caching, the contents is display within a iframe

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-Equiv="Cache-Control" Content="no-cache"> <meta http-Equiv="Pragma" Content="no-cache"> <meta http-Equiv="Expires" Content="0"> 

But it has no effect, any ideas?

1
  • What makes you think it has no effect? How do you study the effects, and are you studying proxy caches or browser caches? Commented Jan 18, 2013 at 9:54

2 Answers 2

2

I always try to use HTTP headers to control caching as they are more likely to be observed by all caches. With that said if you need to set this in the html I would suggest the following:

<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" /> 
Sign up to request clarification or add additional context in comments.

Comments

2

I'm not 100% sure if this works in every situation, but frustration just as you've been having has lead me to throw every meta tag I can behind the problem all at once. I'm using PHP, so I'm letting it populate the contents of the meta tags with a date 24 hours prior to current time.

<!-- Prevent Caching of this Page --> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="<?php echo gmdate('D, d M Y H:i:s', time()-86400) . ' GMT' ?>" /> <meta http-equiv="last-modified" content="<?php echo gmdate('D, d M Y H:i:s', time()-86400) . ' GMT' ?>" /> 

Through googling, I'd found out that setting the 'Expires' http-equiv to '0' doesn't work in all situations and it's best to have a valid date that's in the past.

I sincerely hope this is good advice, and if it isn't, someone please correct me so I can update my own practices over here.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.