Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

prevent caching in javascript

prevent caching in javascript


document.write("<img src=\"yourimage.gif?" + Math.random() + "\" />");

Here Math.random() is the key here since its always different per load and enforces a different version!!.

Math.random() returns a random number between 0 and 1 (Eg:0.something..)



This post first appeared on Computer Bapu, please read the originial post: here

Share the post

prevent caching in javascript

×

Subscribe to Computer Bapu

Get updates delivered right to your inbox!

Thank you for your subscription

×