0

I have an image in my html : <img height="40" src="{{Variables.path}}">

I want to rebind the image file if the file is changed. But not the name of file, file's itself is changing with same name. I am recreating another image file with same name.

I want to rebind the image source to image an tried this to trigger bind event:

 var tmp = Variables.path;
 Variables.path = "";
 Variables.path = tmp;

Bu this is not rebinding image source.

I tried changing file name and it rebinds source. Like this :

Variables.path = "another.png";

But I should not change the file name. I can just recreate it with same name.

osmanraifgunes
  • 1,327
  • 2
  • 15
  • 37

1 Answers1

0

This problem seems to related to cache of browser (or hybrid app). So solved by assigning random querstring to img source url :

Variables.path = "another.png" + "?query=" + Math.floor(Math.random() * Math.floor(5000));

solved with help of this question

osmanraifgunes
  • 1,327
  • 2
  • 15
  • 37