?
Solved

Refresh an HTML page.

Posted on 1998-12-01
4
Medium Priority
?
222 Views
Last Modified: 2010-04-09
Hello there.

I have a script which updates HTML pages on my site.
But the users of the sites see the version on their cache and not the new updated one.

How can I force any new request for an updated page to get the new one, instead of the cached one?
0
Comment
Question by:semuel
[X]
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
  • 2
4 Comments
 
LVL 1

Expert Comment

by:squimph
ID: 1840135
For netscape users, you can use a "no-cache" directive in the <HEAD> section of your HTML pages like this:

<head>
<meta http-equiv="Pragma" content="no-cache">
</head>

MS internet explorer uses something different (grr!). For MSIE, apparently you have to use something like this:

<head>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">
</head>

Notice the date in the above is already past. (I got this hint from http://www.microsoft.com/workshop/author/support/faq.asp)
0
 
LVL 1

Author Comment

by:semuel
ID: 1840136
Hello squimph.

It's a nice answer, but not what I've asked.
in your way, the browser will never use his cache, and always will refresh the page.

what I want is to cause the browser to compare the file's date, and if the file changed from the last time it was cached, it'll refresh.
of course, it's resnable to think that it'll happend anyway, but it's not the case.
I'm using netscape and Apache server.

thanks.
0
 
LVL 1

Accepted Solution

by:
squimph earned 100 total points
ID: 1840137
I'm afraid "don't cache" may be the best option available. Browsers *DO* check the last modified date of the HTML document and load a fresh copy if it's changed (it's called a conditional GET)... the problem is, most browsers default setting is to check the date only once each time the browser has loaded.

There is a setting to "check date each time" but you have to go into the settings panel to manually set that... something you can't count on users doing. (The setting in MSIE 4 is buried under View -> Internet options -> General -> Temporary internet files -> Settings. In Netscape 4 it's under Edit -> Preferences -> Advanced -> Cache)

You can try putting an "expires" tag in your pages as I mentioned above with the time of the next update for the HTML page. There is also an Apache add-in module that sets "expires" headers automatically for selected files, but I understand netscape ignores "expires".

Using a "no-cache" tag may not be as bad as it sounds... it applies only to the HTML, not all the images associated with a page. Usually the images are what take time to load, so depending on how large your pages are, forcing the browser to download just the html each time might not be that bad.
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1840138
Actually, just use the expires tag (and Netscape does use the tag) the way it was originally supposed to be used.  Set the page to expire when you expect to have new code up.  (Yeah, I know, this requires planning ahead...)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

719 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