Skip to content

Instantly share code, notes, and snippets.

@hughes
Last active August 29, 2015 14:04
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 hughes/b346035df1074d4b0caf to your computer and use it in GitHub Desktop.
Save hughes/b346035df1074d4b0caf to your computer and use it in GitHub Desktop.
function reloadCSS() {
var d = (new Date()).getTime();
$('link[rel=stylesheet]').each(function (i, el) {
var href = $(el).attr('href');
if (href.indexOf('?') === -1) {
href += '?_=' + d;
} else {
if (href.indexOf('_=') === -1) {
href += '&_=' + d;
} else {
href = href.replace( /(\_\=[\d+])/ig, '_=' + d);
}
}
$(el).attr('href', href);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment