Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created October 29, 2009 22:38
Show Gist options
  • Save paulirish/221905 to your computer and use it in GitHub Desktop.
Save paulirish/221905 to your computer and use it in GitHub Desktop.
// easy refresh-css keybinding to alt-w
// alt-r was taken in IE, so consider this a CSS Weefresh
// original code from http://paulirish.com/2008/how-to-iterate-quickly-when-debugging-css/
$(document).keyup(function(e){
if ( e.which == 87 && e.altKey){
var h,a,f;a=document.getElementsByTagName('link');for(h=0;h<a.length;h++){f=a[h];if(f.rel.toLowerCase().match(/stylesheet/)&&f.href){var g=f.href.replace(/(&|\?)forceReload=\d+/,'');f.href=g+(g.match(/\?/)?'&':'?')+'forceReload='+(new Date().valueOf())}}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment