How to change image in cache from javascript

I have an asp image control. ImageUrl = "images / avator.jpg". I change this image on the server and then set the imageUrl the same as the previous url on the client. but the image hasn't changed. When I click the refresh button, the image changes. How to change the cached image won't change the url?

+2


source to share


1 answer


You can add a random number as a paramentr to avoid caching.

<img src="http://someurl.com/avatar.png?version=0.01.135";

      



The best way is to add the build version number of the application. So every time you change something, everything will be loaded again.

+5


source







All Articles