Solved

How ensure that up-to-date pages are displayed, not cached ones ?

Posted on 2007-04-03
4
197 Views
Last Modified: 2013-11-19
Hi,

I am maintaining a website for my mother where she is displaying her paintings, www.taimiborg.se . It's a very small 'old-school' site that does not use cookies or any other things (at least not that I consciously implemented).

Yesterday I made an update to a page, Utställnignar/Upcoming exhibitions. I could see the new page immediately but some 12 hours later my mother called me and said she constantly got the old page.

It seems to me that it was a cache issue because when I told her to refresh the page the new one appeared.

I usually don't have problems like this since I have set the cache in all my browsers to small sizes and frequent clearing. However, there must be many users like my mother who don't really know what a cache is and why one can refresh a page, or clear the cache habitually.

Actually I thought that this was somewhat of a non-problem and that even if IE/Firefox/Opera has allowed cache sizes of 200mb (and thus will keep files for a long times before it automatically starts purging to make room for newer files), that once I close my browser and then restart it, when loading a page my browser will compare the cached page to the requested page. I thought this was normal cache behaviour of browsers, but the experience of my mother suggests otherwise.

So I wonder: when developing websites, what is the standard method for trying to ensure that a visitor is viewing the most up-to-date pages rather than some old cached ones on their harddrives? Should cookies be used for this? Or some meta-tag?

Please bear in mind that I am not a professional HTML programmer (obviously) so I appreciate pedagogical answers.

Thank you!
0
Comment
Question by:PierreDutronc
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
JerSchneid earned 125 total points
Comment Utility
This is obviously a bit browser specific, but I think the best you can do is include all the appropriate META tags to indicate that the page should not be cached (or cached for the desired amount of time)

Check out this page for some nice details:

http://www.i18nguy.com/markup/metatags.html

If you don't want it cached at all, include these tags:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="expires" CONTENT="0">
0
 

Author Comment

by:PierreDutronc
Comment Utility
Are those meta tags strictly only HTML ?

From browsing around I had got the impression that pragma and cache-control were dependent on PHP or something, or maybe some serverside programs...

(I don't know anything about PHP or serverside programs etc... I am looking for a pure HTML solution that can be specified inside the html document.)
0
 
LVL 2

Expert Comment

by:JerSchneid
Comment Utility
Yes!  <META> tags are pure HTML.  They have nothing to do with PHP or any other server-side programming language.
0
 

Author Comment

by:PierreDutronc
Comment Utility
Sorry to bother with another followup, but are there any downsides to specifying no-cache or expiry dates?

For instance, how do those tags interact with the google robot?

If I include the three tags above - or alternatively simply allow caching but specify expiry every 7 days even though the content is not likely to change that often - could this affect in any way how google indexes and ranks the site?

I am afraid the google-robot would see that I am forcing it to come back in vain and thus penalise me by dropping my ranking. It's a bit paranoid, but I guess it would actually be in Goole's interest to keep people from forcing the bot to come back when nothing has changed.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now