0

I am using electron for building a Desktop App.The App is using some java code that is generating a QRCode and placing it in a file in file-system in the same directory as that of the application code. I use a button to load the image from file system using the img tag with the help of javascipt as follows :

document.getElementById('QRCodeImage').src = "./QRCodeTest.png";

The problem is when the java code is again refreshing the image it is not reflecting in the app and still showing the previous image.Please Help!!

PS: I am using nodejs eventemitter.emit to publish the event to load the image from file system.

  • 1
    Possible duplicate of [Is there a way to force browsers to refresh/download images?](https://stackoverflow.com/questions/1431512/is-there-a-way-to-force-browsers-to-refresh-download-images) and [Refresh image with a new one at the same url](https://stackoverflow.com/questions/1077041/refresh-image-with-a-new-one-at-the-same-url) and no doubt so many more. – George Oct 30 '17 at 09:34

1 Answers1

0
document.getElementById('QRCodeImage').src = "./QRCodeTest.png?update="+ +new Date();
Jonas Wilms
  • 132,000
  • 20
  • 149
  • 151