prevent caching per especial file in HTML page via javascript

today I’m here to teach , how could you  prevent cashing in HTML page and prevent caching  for especial file !,

set SRC attr with external javascript function or jquery here I used jquery .

$('#gallery1').attr("src", "imgs/gallery/g1.jpg?"+d.getTime());

or method without jquery !

this trick link a jpeg file with a extra parameter like date ( date and time per mini s ) to browser and browser think it’s new one and every time try to get it , and we have noe cache for this image !!

You May Also Like

About the Author: mohammad

Leave a Reply

Your email address will not be published. Required fields are marked *