Skip to content

Instantly share code, notes, and snippets.

@maxicecilia
Created September 6, 2014 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxicecilia/1159d0548306507b363f to your computer and use it in GitHub Desktop.
Save maxicecilia/1159d0548306507b363f to your computer and use it in GitHub Desktop.
Simply script to avoid cache in js/css files using javascript only.
<script type="text/javascript" src="whatever.js"></script>
<script type="text/javascript">
(function(s){
s = s[s.length - 2];
s.src = s.src + '?bustcache=' + new Date().getTime();
})(document.getElementsByTagName('script'));
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment