Last active
February 24, 2021 09:55
-
-
Save DavidWells/590e2ae44894de612446 to your computer and use it in GitHub Desktop.
Clear Browser cache. Run in your browsers javascript console
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
//Cache Buster | |
(function (){ | |
var rep = /.*\?.*/, | |
links = document.getElementsByTagName('link'), | |
scripts = document.getElementsByTagName('script'), | |
process_scripts = false; | |
for (var i=0;i<links.length;i++){ | |
var link = links[i], | |
href = link.href; | |
if(rep.test(href)){ | |
link.href = href+'&'+Date.now(); | |
} | |
else{ | |
link.href = href+'?'+Date.now(); | |
} | |
} | |
if(process_scripts){ | |
for (var i=0;i<scripts.length;i++){ | |
var script = scripts[i], | |
src = script.src; | |
if(rep.test(src)){ | |
script.src = src+'&'+Date.now(); | |
} | |
else{ | |
script.src = src+'?'+Date.now(); | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, What is other solutions ? Thanks