Solved

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

Posted on 2007-04-03
4
199 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
ID: 18855549
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
ID: 18881222
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
ID: 18887543
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
ID: 18910623
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Blog posts not showing up on Blog page 7 60
Wrapper for APPs 9 76
bootstrap footer centering and columns alignement 3 59
ASP.NET MVC 2 31
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

803 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