javascript - Force image reload keeping url -


I usually use the src change to refresh the image:

  Var img = $ (this) .find ('img'); Var src = img.attr ('src'); $ AJAX ({success: function} {img.attr ('src', src + '? R =' + Math.random ()). Load (function () {img.attr ('src', src); });}});  

To use the previous default path

  img.attr ('src', src);  

But I'm refunding my previous image, so the browser still has to keep this image in the cache. How can I force the browser to reload the url to keep this image?

To prevent you from loading a cachebuster, the browser to load its timestamp query parameter: < / P>

  img.attr ('src', src + '? T =' + new date (.) GetTime ());  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -