Reload CSS Bookmarklet
Nick asked me today if there was a way to just reload the stylesheets without having to reload the whole page, which can be frustrating for AJAX development. I hacked at it for a bit and stuck it on our development environment, then cleaned it up into a bookmarklet. Drag the following link to your toolbar for CSS reloading happiness & superior quality.
Update: Fixed it to work in Internet Explorer.* Turns out the original code was doing too much work, adding/removing link
elements. The new code simply replaces the href
attribute with a randomized value.
javascript:(function() { var e = document.getElementsByTagName( "link" ); for( var i = 0; i < e.length; i++ ) if( e[ i ].rel.match( /stylesheet/ ) ) e[ i ].setAttribute( "href", e[ i ].getAttribute( "href" ).replace( /\?_r\=[^&]+|$/, "?_r=" + Math.random() ) ); })();
* Once. It crashes on the 2nd time, at least in IE6 SP2.