Image Cache re-posted

Discussion in 'Javascript' started by jubes, Jan 8, 2004.

  1. jubes

    jubes Guest

    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.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
     
    jubes, Jan 8, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Nokes

    Cache::Cache Stale Segments

    Jeff Nokes, Sep 30, 2003, in forum: Perl
    Replies:
    0
    Views:
    608
    Jeff Nokes
    Sep 30, 2003
  2. DesignerX

    Page.Cache vs HttpContext.Current.Cache

    DesignerX, Jan 20, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    8,334
    vMike
    Jan 20, 2004
  3. =?Utf-8?B?b25l?=
    Replies:
    1
    Views:
    5,345
    Karl Seguin [MVP]
    Mar 8, 2006
  4. Umeshnath

    download an image POSTed By multipart form-data

    Umeshnath, Aug 11, 2009, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    1,160
    Umeshnath
    Aug 11, 2009
  5. Jake Barnes
    Replies:
    7
    Views:
    224
    Evertjan.
    Dec 8, 2005
Loading...

Share This Page