Google Answers Logo
View Question
 
Q: Meta tag refresh question ( Answered 4 out of 5 stars,   2 Comments )
Question  
Subject: Meta tag refresh question
Category: Computers > Internet
Asked by: stonemens-ga
List Price: $25.00
Posted: 18 Dec 2003 15:43 PST
Expires: 17 Jan 2004 15:43 PST
Question ID: 288488
Greetings,

I operate a web site where I often change the graphic contents on
numerous pages. Our customers are often confused because we say there
are new products on line now, but they see the older content because
of browser caching.

I?fd like to have some automated way of refreshing the page, based
upon a new content date/time function so that the customer will see
the new content on pages that have changed and will retain the cache
version on pages with no changes.

I don?ft want javascript because it conflicts with a php/java function
already on each page.

I guess the ideal solution would be the meta tag refresh with a
content change refresh action based on only new content date or ??? It
should cross browser friendly as possible.

Thanks for your help

Request for Question Clarification by endo-ga on 18 Dec 2003 19:58 PST
Hi,

If you can edit the PHP code than all you would need to do I believe
is to add the following to your pages:


<?php
   header("Cache-Control: private");
   header("Pragma: no-cache");
?>


This should tell browsers not to cache any content. Thus preventing
images from being stored.

Please let me know if this was what you were looking for and if it
solves your problem.

Thanks.
endo
Answer  
Subject: Re: Meta tag refresh question
Answered By: joseleon-ga on 19 Dec 2003 03:11 PST
Rated:4 out of 5 stars
 
Hello, stonemens:

  As you request, the best way to do it is by using metatags:

<meta http-equiv="Expires" content="Mon, 26 Jul 1997 05:00:00 GMT" />
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate" /> 
<meta http-equiv="Pragma" content="no-cache" /> 

You can place them at the very top of your pages, the first one
specifies that the page expires in the "past" so there is no need for
the browser to cache it, the second tag, specifies to don't store the
page, don't cache the contents and check the stored contents (if any)
with the received ones, the third one is for HTTP/1.0 compatibility.

This is what I use in my own dynamic pages to prevent caching and
works in most browsers, if you have any problem, or you want a PHP
only solution, just request for a clarification, this is a technical
question and I'm here to help you until you get what you want.

I hope this is what you were looking for, but in any case, before rate
this question, please, request for a clarification.

Also, if you need help integrating the tags in your site, please,
request for a clarification.

Regards.

Request for Answer Clarification by stonemens-ga on 21 Dec 2003 20:38 PST
Hello,

Sorry for the slow response.

Does your solution do the following as described in my request:

"...new content on pages that have changed and will retain the cache
version on pages with no changes."

Thanks,

Clarification of Answer by joseleon-ga on 22 Dec 2003 06:34 PST
Hello, stonemens:
  That's exactly what the browser is setup to do by default, I mean,
this is how it "should" work, but in most cases, users have proxy
caches in corporations which make necessary to use those metatags to
force refresh.

In any case, and accordingly to the right RFC:

Cache Revalidation and Reload Controls
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4

You can try first with just this metatag:

<meta http-equiv="Cache-Control" content="must-revalidate" /> 

To force any cache device (browser, proxy, etc) to revalidate the
contents to see if have changed.

Tell me if it works the way you want, and keep requesting for
clarifications until we get to a common solution, I'm here to help
you.

Regards.

Request for Answer Clarification by stonemens-ga on 22 Dec 2003 15:19 PST
Hi,

I inserted the meta tag <meta http-equiv="Cache-Control"
content="must-revalidate" /> as you suggested in your clarification
but the problem issues persist as described in my original question. 
The browser did not pick up a change until I did a refresh, then one
could see the new information.

Thanks,

Clarification of Answer by joseleon-ga on 24 Dec 2003 00:46 PST
Hello, 
  That's what I supose it was going to happen, please, try the
complete solution (the 3 tags) and tell me what happens.

Sorry for take so long to solve this matter, but technical answers
sometimes is a matter of trial and error.

Regards.
stonemens-ga rated this answer:4 out of 5 stars
Thanks for the complete answer to my question.

Comments  
Subject: Re: Meta tag refresh question
From: mehran235-ga on 25 Dec 2003 11:49 PST
 
for forcing the browsers not to cache the page elements specially in
IE browser it is recommended to put a second <head> section after page
</body> tag. This is an unusual way to bypass a bug in IE which caches
the page contents even if it has the following line in its header:
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

I found this solution in MSDN library in this section :
"Pragma: No-cache" Tag May Not Prevent Page from Being Cached

read more at :
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q222/0/64.ASP&NoWebContent=1
Subject: Re: Meta tag refresh question
From: anujji-ga on 08 Jan 2004 02:15 PST
 
A very nice solution.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy