Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh page with new content 2

Status
Not open for further replies.

JillC

Technical User
Jan 10, 2001
241
AU
I have a page which will be updated every couple of months. Searching through this forum I found many suggestions to use
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
in order to force the updated info to display.

I also found a suggestion to use
<META HTTP-EQUIV="Expires" CONTENT="15 Dec 2003"> or similar.

This second option seems to make more sense to me, but I'm still a bit confused. Should the date always be set as the same date that the page is changed? What if it's a future date? I know I seem to be answering my own question, I just want some reassurance that I'm on the right track.

Jill.
 
As long as the date is in the past, it never needs to be changed. It simply tells the browser when the page content expired - and it if was any time in the past, it will (it should) get a new version from the server, instead of using its cached version. Having all 3 of these meta tags wouldn't hurt at all:

Code:
<meta http-equiv="expires" content="Mon, 5 Jan 2004 11:00:00 GMT" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />

Hope this helps,
Dan
 
Frankly, I wouldn't worry about it. Developers only really need to concern themselves about caching when they have pages which are constantly changing, and they want it to be fully refreshed each time a user visits during a particular session.

In your case, the content changes pretty infrequently, so you don't have to worry too much. When people fire up their browser and visit your site, it'll check that there isn't a newer version online than the one in their cache. It's just that (with default settings) the browser won't re-check if the user comes to the same page again later on in their session.

If you do want to consider caching, set the [tt]Expires[/tt] header to the date when the page will be replaced. That way the browser (and any proxy servers in between) will cache the pages properly for their "couple of months" life.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top