Image Caching

Results 1 to 2 of 2

Thread: Image Caching

  1. #1
    Join Date
    Dec 1969

    Default Image Caching

    It appears that this is nore of a server-side list, but the JavaScript listserve to which I belonged (Wrox) has apparently succumbed to budgetary problems, so until I can get pointed to another one I hoped that someone could help me out.<BR><BR>I have the following code in the head of a document:<BR><BR>&#060;script language="Javascript" type="text/JavaScript"&#062;<BR>var Browser = navigator.appName;<BR>if (Browser == "Microsoft Internet Explorer") { var IE = true; } else { var IE = false; }<BR>var Pic = 0;<BR><BR>// Preload images<BR>var aryCreation = new Array();<BR>var aryCurrent = new Array();<BR>for (i = 0; i &#060; 4; i++) {<BR> aryCreation[i] = new Image();<BR> aryCurrent[i] = new Image();<BR> aryCreation[i].src = "Creation/Rot" + i + ".jpg"<BR> aryCurrent[i].src = "Current/Rot" + i + ".jpg"<BR>}<BR><BR>function RunRot() {<BR> if (IE) { document.Creation.filters.blendTrans.Apply(); }<BR> document.Creation.src = aryCreation[Pic].src;<BR> if (IE) { document.Creation.filters.blendTrans.Play(); }<BR> if (IE) { document.Current.filters.blendTrans.Apply(); }<BR> document.Current.src = aryCurrent[Pic].src;<BR> if (IE) { document.Current.filters.blendTrans.Play(); }<BR> Pic++;<BR> if (Pic &#062;= 4) { Pic = 0; }<BR> setTimeout("RunRot()", 6000);<BR>}<BR>&#060;/script&#062;<BR><BR>I call the function from the body. For some reason, when the picture changes, the browser is apparently not taking it from cache (the mouse briefly changes to busy just before the picture changes), but downloading a new copy. The full code is at<BR> Can anyone please tell me why this is happening?<BR><BR>Thanks -<BR><BR>george

  2. #2
    Join Date
    Dec 1969

    Default I see what you mean...

    I wonder if it is because of the blendTrans stuff?<BR><BR>Did you try taking them out (just set IE to false rather than change the code)??<BR><BR>

Posting Permissions

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