Cache-ing images, not pages

Results 1 to 3 of 3

Thread: Cache-ing images, not pages

  1. #1
    Join Date
    Dec 1969

    Default Cache-ing images, not pages

    I&#039;m making a site that requires no cache-ing of pages, so I&#039;ve set the Response.Expires to -1 on each page, but I still want the images on the site to be cached. Does anybody know if this is possible?<BR><BR>Thanks in advance for any help

  2. #2
    Join Date
    Dec 1969

    Default RE: Cache-ing images, not pages

    You can try pre-loading the images using a client side script. Dreamweaver produces the following javascript for pre-loading images.<BR>&#060;script language="JavaScript"&#062;<BR> &#060;!--<BR> function MM_preloadImages() { //v3.0<BR> var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();<BR> var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i&#060;a.length; i++)<BR> if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}<BR> }<BR>&#060;/script&#062;<BR>&#060;body onLoad="MM_preloadImages(&#039;img1url&#039;,img2u rl&#039;)"&#062;

  3. #3
    Join Date
    Dec 1969

    Default HUH?!

    How about putting your images in a separate directory, then enabling Content Expiration on that directory only through IIS?<BR><BR>If you&#039;re being hosted, this will mean a call to their technical support, but I see no reason as to why they would say no. All they do is right-click on the directory you want caching enabled on in IIS, go to Properties, then Content Expiration (from memory), and then change it so that content expires in 7 days (or however long you want).<BR><BR>No mucking about with client-side or server-side code. This automatically puts the correct HTTP response header on the image when it&#039;s requested which tells the client (or a router/firewall between the two) to save a cached version.<BR><BR>Craig.

Posting Permissions

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