Forcing client side image caching

Results 1 to 3 of 3

Thread: Forcing client side image caching

  1. #1
    Tiggy Guest

    Default Forcing client side image caching

    Most of the pages on my site are dynamically generated, and so I use code at the top of my pages to prevent the HTML from being cached - however as there are certain images that make up the furniture of the page and rarely change. <BR><BR>I figure it would be quickest to have the images stored on the users computer, or at least the proxy if they are using one. Can I force the browser/proxy to cache just the images only? I have read the articles on caching I have found and understand the idea of storing data in application variables. But I just can&#039;t quite put my finger on how I would apply this to cache the images on the server. Would I store the image data in an Application variable and then use an external .asp page to print out the image with the appropriate headers? <BR><BR>If that is the case then how do I populate the cache in the first instance? And how would I refresh it?<BR><BR>Many thanks!

  2. #2
    Join Date
    Dec 1969

    Default Preloading an image

    Fuggitaboutit using ASP -- you&#039;ll need client side scripting.<BR><BR>On the window_onload event, just "force" the image into the cache<BR><BR>var myImage = new Image();<BR>myImage.src = "yourpath.gif"<BR><BR>Get more creative and read these into an image array, to prevent hand coding every image.

  3. #3
    Tiggy Guest

    Default Thanks, but not quite what I had in mind

    I&#039;m not too keen on client side scripts as you can never be sure that it will get done (one of the reasons I&#039;d prefer a server side solution if possible). Its something I&#039;ll keep in mind - but I wouldn&#039;t want to have the code on all my pages - it would defeat the point of the exercise.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts