Reload the image while the src does not change?

Discussion in 'JavaScript' started by goldensea80, Sep 3, 2007.

  1. #1
    I am making an uploading thumbnail using ajax and javascript. The thumbail file name is the same, just the folder is different. E.g., a listing named "abc", will have a thumbail: "abc/thumb.jpg".

    So far, everything works fine except when I replace the old thumb by upload the new. The thumnail won't be updated until I refresh the browser.

    Is there a way to reload/refresh the image when the image src does not change?

    Thanks in advances
     
    goldensea80, Sep 3, 2007 IP
  2. mjamesb

    mjamesb Member

    Messages:
    88
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    48
    #2
    its in the browser cache... i saw this example but have not tried it myself..basically when the image is done uploading you can force a refresh by appending a timestamp to the image...would be curious to know if the example below works.

    document.images.myImageName.src = 'picture.gif?' + now.getTime();
     
    mjamesb, Sep 3, 2007 IP
    goldensea80 likes this.
  3. goldensea80

    goldensea80 Well-Known Member

    Messages:
    422
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Thanks, your idea works! :eek:
     
    goldensea80, Sep 3, 2007 IP