• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

How to make cached pages disappear


I am working on a set of web pages. Security will be very important. The web pages normally get cached in "Temporary Internet Files". I have seen web sites which cause the pages to temporarily appear in the cache and then disappear! I can see the pages in the cache as I load the pages but when I move to a different page on the same site it "deletes" the previous page. When I exit the browser all the pages are gone (except .gif's) - no .html pages are in the cache! The site does not seem to download any ActiveX controls or anything unusual. I have a feeling they are using some "trick" to break the caching process.

I am familiar with the normal browser/caching process but this doesn't seem to fit any of the usual scenarios.

Anyone know how this is done?

1 Solution
You can include some meta tags in the header to set the expiration date and the cache control.

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no=cache">
<meta http-equiv="expires" content="-1">

(-1 for the expires content is actually illegal but should be replaced by the browser with the current date and time.)

These are used to force the browser to load the page from the server each time. I'm not sure if it prevents the page files from actually being copied to the cache folder though.
George46227Author Commented:

Yes I am familiar with the various pragma no-cache commands, they work OK to get a fresh page. But I am looking for a way to prevent the page from being cached at all or at least only get cached temporarily and then disappear from the cache very quickly.

The pages where I have seen this happen look like this (exact values replaced for security reasons):

It is a web mail server. When you load a page it appears in the cache. When you go to another page then the first page disappears and the second page is cached. When you close the browser the last cached page disappears.
I assume it has something to do with using cgi's as the page builder vs. html pages? Like the pages are built on the fly from the cgi's but there is no real "page"?


You're right, the pages are built on the fly, but they are typically HTML pages that are built on the server and then served to the visitor. The visitor's end is unaware that the pages are not static HTML pages. It is doubtful this has anything to do cached files disappearing.

I am unaware of a browser that is capable of rendering a page without first caching it.

This article mentions the use of "no-store" for Mozilla/Firefox instead of "no-cache"


I'm afraid that's all I have on the subject. Surely some of the other experts have crossed this bridge before.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

George46227Author Commented:

"You're right, the pages are built on the fly, but they are typically HTML pages that are built on the server and then served to the visitor. The visitor's end is unaware that the pages are not static HTML pages."

To clarify - how would I know for sure whether or not the pages are built as HTML pages? In the address bar there is the something.cgi+string variables thing as I posted previously, no reference to any .html pages. But in the TIF cache most of the pages are .htm pages. Example: on the Menu page - the address bar says http://www.gizmo.com/long-string-of-numbers/menu.cgi, the file is cached as menu(1).htm, the file opened in notepad certainly contains the usual html headers and tags. The Mailbox page for reading mail is http://www.gizmo.com/long-string-of-numbers/readmail.morenumbers.cgi?uid=Sam&mbx=Main, cached as readmail.somenumbers(1).htm.
How does the browser know to cache them as .htm? I can take any .htm file, re-name it to .txt on the web server, load it in the browser, it will be cached as filename.txt (even though it's format is obviously .htm, contains headers and tags, etc.), it will load and behave as .htm even with .txt as the filename. Does the cgi send back a response that includes a filename such as "menu.htm" which would not show in the address bar but only shows in the cache?


I can't be certain about the browser behavior. However, a conforming HTML page begins with a DOCTYPE declaration which tells the browser what version of and which markup language to use. The browser may be using this declaration to determine the filename extension that it uses in the cache when the url requested is not a file type that the browser is capabable of executing. A CGI (Common Gateway Interface) file is a script that the server executes which builds a web page dynamically and then serves it to the client/visitor. That page is usually HTML but is more and more often XHTML. Both these file types use the same .html or .htm extension. The DOCTYPE declaration separates the two. If a page does not include the DOCTYPE declaration, it is assumed to be HTML by most browsers.

The question mark following the .cgi extension contains the parameters or variables on which the script must act dynamically. The common syntax is variableName=variableValue. Multiple variable/value strings are concatenated with the ampersand (&).

The browser recognizes .txt files as a renderable file and processes it as such. If the .txt file happens to have recognizable code, it processes that code. If not, it simply renders the text.

I hope this is helpful for your understanding. Unfortunately, I doubt if it gets you any closer to a resolution to your problem.
From a security standpoint, this is not possible.  The browser renders the page, ergo the information is retrieved from the server, ergo it can be saved/cached/etc.  While browsers aren't supposed to cache information in certain cases (SSL encrypted connection, which may work well enough for your needs), that doesn't mean they won't.  Or, more to the point, that someone couldn't make them ignore it.  The only truly secure way of displaying information on a page is to let something other than the browser render it.  A java based browser-within-a-browser would accomplish this.  Or, have javascript render the entire page via a javascript XMLHttpRequest call (I don't believe this is cached) which outputs the page to a <div> that is the only actual html in the page of the body.  This is possible, though it makes controlling navigation a bit tricky.  
George46227Author Commented:


I would refund the points and PAQ the question.

1. A specific solution was not provided, specific resources for developing a solution was not provided; in fact both responses to the question seem to indicate that such a thing may not be possible within reason
-so refund the points

2. The question is potentially interesting to others and the discussion was helpful even if only to point out that such a thing is difficult - if not impossible - to do within reason; I think others may benefit from the discussion if they similar issues
-so PAQ the question

If you decide to split the points - fine, I have no problem with that, my preference would be to refund and PAQ. My personal feeling is points should be given for solutions, resources, useful suggestions which lead to a solution, etc. - not just for responding to the question, even if the response is interesting or confirms the lack of a solution, etc.

I do appreciate walkerke and ClickCentric for their responses; they are knowledgeable, the responses were intelligent and the effort was made to be helpful.

I will not object to whatever your final decision is.


I have no objection to the author's suggestion.
PAQed with points refunded (250)

Community Support Moderator

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now