Last active
August 29, 2015 14:02
-
-
Save andrioid/8a23abbbea2adc433279 to your computer and use it in GitHub Desktop.
I was playing with RRD and network graphs at home (what do normal people do on holidays?). Anyway... If you include this script in your markup, it will periodically reload all images it can find. For better or worse...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function updateImages(){ | |
var images = document.images; | |
for (var i=0; i<images.length; i++) { | |
var imagename = images[i].src.match(/((.*)\.(png|gif|jpg))/i); | |
if (imagename) { | |
var timestamp = new Date().getTime(); | |
images[i].src = imagename[0] + "?nocache=" + timestamp; | |
} | |
} | |
} | |
setInterval(function() { | |
updateImages(); | |
}, 300000); // 5 min | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment