Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Image Cache re-posted

Reply
Thread Tools

Image Cache re-posted

 
 
jubes
Guest
Posts: n/a
 
      01-08-2004
Hi,

Sorry about this, I posted this message yesterday and it ended up in
an existing thread. Hope this time it starts a new one.

I've been developing an intranet application that uses IE 5.5 and have
come across a problem, well sort of.

Since the application uses frames I use an array of Image objects to
cache the image in the top frame. Now replacing an exsiting the image
source on an existing image tag is easy (ie imgTag.src =
imgArry[i].src) and there is no HTTP request back to the server.

Now expanding that concept further if I create an image tag with
javascript by using divTag.innerHTML = '<img src="imgURL">' this
created tag will make an HTTP request to the server, and since I've
all ready cached all images the server returns a 304 (not modified)
and does not return image data.

So to avoid the HTTP request I tried divTag.innerHTML = '<img src=""
onerror="func(this)" imgIndex="1">'

where

function func(ref){
ref.src =imgArry[ref.imgIndex].src];
}

therefore in this case we have an existing image tag, albeit it throws
an error, and do the normal image replace. now in this scenerio it
still makes a HTTP request.

Why does the last scenario make a HTTP request? Also is there a way to
create an image tag on the fly without it making a HTTP request?

thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET Cache vs Window System Cache Sergey via DotNetMonster.com ASP .Net 0 11-15-2006 03:33 PM
client-side cache vs server-side cache vs ajax vs asp.net callback =?Utf-8?B?b25l?= ASP .Net 1 03-08-2006 12:25 PM
image cache causes trouble, setInterval and innerHTML fail, together, to get me a new image Jake Barnes Javascript 7 12-08-2005 09:09 AM
Page.Cache vs HttpContext.Current.Cache DesignerX ASP .Net 5 01-20-2004 10:55 PM
Cache::Cache Stale Segments Jeff Nokes Perl 0 09-30-2003 04:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57