...

View Full Version : browser cache



yvorl
05-20-2009, 01:31 PM
Hi!

I don't know if I ask this in the right place, but:

Is it possible to prevent ie to save files in temporary internet files folder?
I mean disable it with javascript or anything else.

I tried this:


header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);


But when a call a picture with <img.... it still stored in temp folder.

Thx for your help

Philip M
05-20-2009, 03:44 PM
In order to assure a non-cache, you should add a meta tag like below after the <head> tag of your webpage:

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

If your page is coming from a server side script (PHP or otherwise) you can use this simple technique:

<img src="myimage.jpg?insert_datetime_stamp_here" alt="Some text" />

Use whatever function in your server side script that will put the current date and time into that space after the ?. That will prevent cacheing.

rnd me
05-21-2009, 06:44 AM
<img src="myimage.jpg?insert_datetime_stamp_here" alt="Some text" />

Use whatever function in your server side script that will put the current date and time into that space after the ?. That will prevent cacheing.

doesn't seem to work for me (IE7).
in fact, it actually makes it worse: it stores a new copy each time it's loaded that way (in my testing).

you could serve just the images from an HTTPS site.
since images can come from anywhere, the HTML should work exactly the same.
browsers shouldn't cache HTTPS-based resources, and when i tested in IE7, that seems to be the case with images.

yvorl
05-21-2009, 07:13 AM
Since the pictures I need are stored on a non-https server and timestamp solution has the same results as Rnd me had
"it stores a new copy each time it's loaded that way" (IE8) it seem it's just not possible to do..:(

Thank you anyway



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum