0
function display_hist()
{   
    document.getElementById("display_area").innerHTML=''; 
    document.getElementById("display_area").innerHTML='<img id="hist" src="hist.jpg" width=480 height=480>';


}

I have an ajax function that tries to reload an image with the same URL when called by some other code. However, I keep getting the cached image. How can I force the browser to reload the image? Or how to turn off cache functions in firefox COMPLETELY(who thinks he is so smart by caching the content, I have enough! I DON'T WANT ANY CACHE!!) , that is fine as well.

Alfred Zhong
  • 6,773
  • 11
  • 47
  • 59
  • Possible duplicate: http://stackoverflow.com/questions/1077041/refresh-image-with-a-new-one-at-the-same-url – Ian Hunter Dec 07 '12 at 04:49
  • Not quite, that post uses codes like var newImage = new Image(); newImage.src = "http://localhost/image.jpg"; – Alfred Zhong Dec 07 '12 at 05:01
  • 1
    But the idea's the same. Instead of using `hist.jpg` you would do something like `"hist.jpg?" + Date.now()` – Ian Hunter Dec 07 '12 at 05:04
  • `who thinks he is so smart by caching the content, I have enough! I DON'T WANT ANY CACHE!!` Dude Chrome is the mother of all caching. Why blame just one browser, blame all. I think you are not bothered about your pages loading slow for your users. Besides that point, you can set headers in IIS and Apache to not cache your images (or other static content). – Tanzeel Kazi Dec 07 '12 at 05:15
  • You are totally right. I am not trying to attach firefox. I am just feel frustrated after so much effort and still can't to get the image reloaded. – Alfred Zhong Dec 07 '12 at 06:55

0 Answers0