Skip to content

Instantly share code, notes, and snippets.

@zetter
Created March 21, 2012 18:35
Show Gist options
  • Save zetter/2150910 to your computer and use it in GitHub Desktop.
Save zetter/2150910 to your computer and use it in GitHub Desktop.
Modified ReCSS to reload styles on window focus

Only tested in chrome, shove this in a bookmarklet:

javascript:void(function(){var r=(function(){var i,a,s;a=document.getElementsByTagName('link');for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href) {var h=s.href.replace(/(&|%5C?)forceReload=\d+/,'');s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf())}}}); window.addEventListener('focus',r,false)})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment