homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

How to cache an image until browser closes?

 7:07 am on Jun 24, 2010 (gmt 0)

On a particular site I have images which shouldn't be cached. On the other hand the images shouldn't be reloaded every time the visitor changes to another page on the site where one of those images is displayed, as long as the browser hasn't been closed in between.

Currently I am serving the following headers:

Expires: 0
Cache-Control: private, pre-check=0, post-check=0, max-age=0
Pragma: no-cache

These headers work in that no version of the images is left on the disk, but the browser tries to reload them every time they are on a page, even within a single browser session. I am trying to emulate the behavior of cookies which are valid during the lifetime of the browser, but I haven't found the working combination of headers yet. Any idea's how I can achieve my goal?



 9:41 pm on Oct 9, 2010 (gmt 0)

You can use for IE.

<meta http-equiv="cache-control" content="no-store" />

The Meta HTTP-EQUIV CACHE-CONTROL is specifically used by Internet Explorer.

The allowed values are:

* Public - may be cached in public shared caches
* Private - may only be cached in private cache
* no-Cache - may not be cached
* no-Store - may be cached but not archived


 2:16 am on Oct 10, 2010 (gmt 0)

Hi OceanSky,

Thanks for the hint and also welcome to WebmasterWorld!
I will certainly try the no-store cache option. It may be a good alternative for what I am using now.


 10:04 am on Oct 13, 2010 (gmt 0)

If you use an application script to handle/output the images then you can setup a cookie or pass an id with the url to the script that handles the image based on session etc. Should work on all browsers but is more work.

If I understand right now you are setting up the header from the server for specific file types not via the application.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
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