views:

391

answers:

4

How to prevent browser from storing particular page in temporary files folder ? Is there any solution using meta tags ? i've tried with meta tag: pragma, expire, cache-control but it doesnt work.

A: 

This question (or more to the point, its answers) should help. I don't think there's any way to be certain that the browser won't write the content to a temporary file (for purposes other than caching), though.

T.J. Crowder
A: 

Here is the complete set of response headers which ought to work in all browsers:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

The Cache-Control is according the HTTP 1.1 specification. The Pragma is according the HTTP 1.0 specification. The Expires is to avoid Proxies to cache the content.

If this still fails, then you just need to clear the browser cache before testing.

If still in vain, then the problem lies somewhere else. Common case is that starters think that the included files like scripts, stylesheets and images are cached according the instructions of the parent page. This is thus not true. They all account as independent requests and thus have their own set of controllable response headers.

BalusC
A: 

One way I've used in the past is to append a unique value to the query

eg: ImageGen.php?rid=548268

rid being a random gnerated number.

Pino
Terrible. This is just sign of ignorance of how HTTP works.
BalusC
that shouldn't work according to the HTTP spec, I think (though it does work in Firefox at least). http://en.wikipedia.org/wiki/HTTP_ETag - ETag is the same concept applied properly
Bozho
Hang on, this is a work around specificly for internet explorer that we have had to use in the past especially with things like Image generation. "Terrible" maybe but we dont live in a perfect world.
Pino
@Bozho (running into each other a lot, aren't we? :) ) - It should work, actually, although it is legacy -- but only if the server doesn't include any expiration headers. Section 13.9 in the spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.9 But yeah, it's been a *long* time since this was the right way to do this. @Pino: IE6 respects expiration headers.
T.J. Crowder
Pino: the image should have the right response headers supplied. This is the responsiblity of the imageservlet, not the JSP page.
BalusC
A: 

No, you can't. MSHTML must store the file for some short period of time in order to render it. It is a built-in design requirement.

jeffamaphone
i need cache to be cleared after refresh and it doesnt work. only when i restart browser cache is cleared.
michal
Is this for debugging, or for some other reason. If you just want to clear it for your own development purposes, just use the command line to rmdir /s /q the cache directory.
jeffamaphone
no, it's for normal use of web application, because it's using oracle mapviewer to render map, and need to refresh page for update change of the map content.
michal