I have a WebBrowser control on an WPF page. The HTML page loaded into the WebBrowser control displays images for the WPF application. I have a JavaScript callback from the WPF page into the HTML page telling the page that the images have changed and to reload images. I can’t seem to find any way to tell the browser that the underlying file in the tag has changed.
How do I reload the img?
I’ve tried just changing the src attribute and I’ve also tired things like this:
$("#img1").attr("src", "");
$("#img2").attr("src", "");
$("#img1").attr("src", image1);
$("#img2").attr("src", image2);
The first time the function is called the images are displayed. When the image is changed and the function is called again, the original image remains.
Set the source new with a random query part. E.g. img.png?0001 and so on
With this trick every call has a new url and the browser control cannot annoy you with caching stuff.