They say it cannot be done, true?

Discussion in 'Javascript' started by News Reader, Jan 27, 2005.

  1. News Reader

    News Reader Guest

    The default method of refreshing images is to
    append a "?" plus a random value to its URL.
    Then it should reload from the server without
    being fetched from the cache.

    Now, I have images to update which are
    generated by the server and this server won't
    accept any ?+numbers to be appended to
    the URLs, because this would cause a distortion
    of the submitted parameters. I was told that
    there is no solution to this problem, except to
    disable the browser's cache.

    Theoretically I could put every image to an
    iframe and use meta tags to have them
    periodically refreshed. But I don't like this
    approach, because this would make updating
    all the required parameters dynamically a
    headache.

    Does anyone have a better idea?
    News Reader, Jan 27, 2005
    #1
    1. Advertising

  2. News Reader

    Matthew Lock Guest

    Matthew Lock, Jan 27, 2005
    #2
    1. Advertising

  3. News Reader

    Matthew Lock Guest

    You could also experiment with appending extra path information to the
    url. Though IIS by default seems to choke on it, Apache seems fine:
    http://server/image/123456
    Matthew Lock, Jan 27, 2005
    #3
  4. News Reader

    Randell D. Guest

    News Reader wrote:

    > The default method of refreshing images is to
    > append a "?" plus a random value to its URL.
    > Then it should reload from the server without
    > being fetched from the cache.
    >
    > Now, I have images to update which are
    > generated by the server and this server won't
    > accept any ?+numbers to be appended to
    > the URLs, because this would cause a distortion
    > of the submitted parameters. I was told that
    > there is no solution to this problem, except to
    > disable the browser's cache.
    >
    > Theoretically I could put every image to an
    > iframe and use meta tags to have them
    > periodically refreshed. But I don't like this
    > approach, because this would make updating
    > all the required parameters dynamically a
    > headache.
    >
    > Does anyone have a better idea?
    >
    >
    >



    I'm still new to javascript but I think I'm getting to grips with it...
    But if I had that problem, then my work around (which may not work in
    100% all web browsers) would be to give all images a name... thus

    <img src=/image.jpg id="imagename">

    Then I would perform a javascript routine to replace the image using the
    id tag as a reference using something like

    document.getElementById('imagename').innerHTML="<img src=/image2.jpg>";

    This routine could have an array containing image names which runs every
    x number of seconds, or on a mouse over or whatever...

    Would that help resolve your problem? Perhaps not - I'm thinking that
    your image names seem never to change... dunno... perhaps there is
    something there that will give you a work around, true?

    randelld
    Randell D., Jan 27, 2005
    #4
  5. News Reader

    News Reader Guest

    Thanks guys for your posts.

    First of all - I guess I've found a solution:
    The server appears to accept "&rand=" plus
    a dummy parameter value. So I can go the
    usual approach mutating this value. (So
    Matthew's 1st post was on track.)

    Unfortunately this does not really satisfy
    my desire to use javascript to control
    if an image can be fetched from the cache
    or if it has to be reloaded from the server.

    Nevertheless, just some short replies
    to your posts:

    Matthew: Extra path info wom't work,
    but as mentioned "&rand=nnnn" is
    accepted.

    Micha & Randell D: The browser's cache
    seems to be compared just to the url
    which generates the server's response.
    There is no image name involved.
    News Reader, Jan 27, 2005
    #5
    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. George Hester
    Replies:
    3
    Views:
    3,477
    Carl Prothman [MVP]
    Aug 11, 2003
  2. U S Contractors Offering Service A Non-profit

    " Hind sight is that of 20/20 they say ? "

    U S Contractors Offering Service A Non-profit, Nov 7, 2006, in forum: C Programming
    Replies:
    0
    Views:
    301
    U S Contractors Offering Service A Non-profit
    Nov 7, 2006
  3. bdb112
    Replies:
    45
    Views:
    1,297
    jazbees
    Apr 29, 2009
  4. David A. Black
    Replies:
    2
    Views:
    210
    Tim Hunter
    Aug 19, 2004
  5. Zhidian Du
    Replies:
    2
    Views:
    95
    David Efflandt
    Feb 21, 2004
Loading...

Share This Page