1

I have an image (from the static folder, pretty straightforward)in my simple html template with a button, clicking the button will perform some background processes, getting a new image and replacing the old one in the static folder. After getting the new image and refreshing the page, the page still display the old one, but this only happen in Google Chrome, it works as expected in IE and Edge. Looking at the terminal output, refreshing the page in Chrome doesn't send a request to get the image, while refreshing in Edge or IE will request for the image again.

This looks more like a Chrome problem, on how it handle the image, but is there anyway around this by varying the code, since most people are using Chrome, and so I don't want to force them to change browser just for my application?

Raja Simon
  • 10,126
  • 5
  • 43
  • 74
daQuincy
  • 13
  • 5
  • 1
    I assume you are using `ajax` to get the image. Try adding a `cache:false` option – Busturdust Mar 28 '17 at 13:28
  • @Busturdust thanks for your reply, sorry for not being clear enough, I'm actually running it on a Raspberry Pi, I simply run a terminal wget command to get the image and move it into the static folder, not ajax – daQuincy Mar 28 '17 at 13:47
  • 1
    Chrome will be caching the image. It might be worth changing the image filename each time when rendering it. Chrome is pretty heavy on caching. – Keef Baker Mar 28 '17 at 15:15
  • 1
    @daQuincy Can also try adding cache control to the HTML as seen on http://stackoverflow.com/questions/1341089/using-meta-tags-to-turn-off-caching-in-all-browsers .... For example `` – Busturdust Mar 28 '17 at 16:30

0 Answers0