Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I cancel page caching

Status
Not open for further replies.

tango1948

Programmer
Dec 23, 2006
111
IL
Hi
I'm trying to prevent caching for an HTML page using
Code:
<html><head><title> Load it</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>

But it still appears in Temporary Internet Files, the expiary date has passed but if I double click the file it opens as normal. Is it possible to prevent the page from appearing in the Temporary Files, I'm currently testing the application using localhost.


 
Nope. If you want to see a page, it needs to be downloaded onto your computer -- say into a temporary internet files folder. If you want to delete it from there, you should just manually remove the site.

Your tags will help the browser to always request a new version from the website and ignore the one stored in temp folder.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Hi Vragabond,
I thought no-cache meant that no copies of the file would be kept in Temporary Files folder so that people couldn't go to that folder and take sensative info such as credit card numbers. When I specify the above code in the code behind of my aspx pages there is no trace of the files on the local pc.
How can I do the same for an HTML page?
 
Do not post it on the internet. You cannot prevent files to be transferred to local computers, because they need to be at a local computer to be shown. Whatever is viewed on the internet, will be copied on everyone's local machine.

I don't know what you mean with the code behind, but all server side scripting (like the .NET development that you use) is being processed on the server and eventually an html page is served to the user -- that html page is saved on the local machine just like any other webpage.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
The "no cache" is a server generated parameter related to the need for retransmission, not relating to how the server desires the browser to save files.

Said another way:

If your server application has a dynamic content page that may very well change from one page refresh to another, you would include the various "no cache" controls to tell the browser that the browser needs to fetch that page's content as "new" EVERY time. (rough on bandwidth)

However, the server is NOT going to be telling the browser how to manage the local copies of the files it has. A "no cache" server page will still get written to the browser's local temp files area so that the browser can render the page.

To my knowledge the browser ALWAYS writes files first, and renders them to the user afterwards.

Your browser's Options control when and how often any content is purged from the local temp file area.

HTTPS content is handled only slightly differently, and I believe that HTTPS content has the default behavior of "no cache" as I noted above. Check me on that one before you take it as gospel.

D.E.R. Management - IT Project Management Consulting
 
Also there are issues with the user and their ISP serving cached pages.

You might request "no-cache" and the browser makes a request for the page again from the server, but because the ISP sits inbetween, the ISP might decide it's not going to request the page again and so shows 'their' cached page.

I know I've had problems with this and NTL , the trick is normally to put a ? on the end of the static HTML url.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top