Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2007-04-03
4
200 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Read about why website design really matters in today's demanding market.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

809 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