homepage Welcome to WebmasterWorld Guest from 54.227.146.68
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

    
Keep page from being cached?
How do you keep a page from being cached on a visitor's PC?
croakingtoad




msg:354874
 8:05 am on Feb 13, 2004 (gmt 0)

I need to keep a particular page from being auto-cached on a user's PC. I have experienced that some visitors' computers are caching my pages, which isn't that big of a problem usually, but this particular page is an order form that changes frequently. Is there any meta code or otherwise to instruct the browser NOT to cache the page?

I'm not seeking to prevent someone from purposefully doing this, only to keep the browser from doing it automatically...?

 

RonPK




msg:354875
 12:44 pm on Feb 14, 2004 (gmt 0)

You could try these meta tags:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

I've seen advises to put them at the end of the document as well, like this:

</body>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
</html>

Can't guarantee that any of this works...

racer_x




msg:354876
 10:30 pm on Feb 14, 2004 (gmt 0)

This is difficult to do, even if you use HTTP or HTML headers to say that a file should not be cached, some browsers are configured to ignore this and cache it anyway. Then use the version from the cache for the current session, without checking the server to see if any changes have taken place.

One way to get around this is to trick the browser into thinking that the file is created by a script and could be different each time it is retrieved from the server. You can do that by adding a '?' to the end of the url.
For example
[example.org...]

The webserver will ignore the '?' and still serve up the correct page.

RonPK




msg:354877
 8:26 am on Feb 16, 2004 (gmt 0)

There's a nice article about preventing caching at h*tp://www.web-caching.com/mnot_tutorial/how.html#CONTROL

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved