Cache Busting Bookmarklets
One of the biggest hassles when trying to track down and squash bugs in a large-scale production environment is dealing with multiple layers of caching. Many of the sites I work on are at least three layers deep: a content delivery network (like Limelight or Akamai), server level file caching (like the W3 Total Cache plugin for WordPress) and the browser’s cache. Forgetting to clear one of those layers has often resulted in lots of time spent trying to debug a problem that’s already been fixed.
Anyhow, I put together a bookmarklet that helps make dealing with this a little less painful. A pretty typical way of getting around a cache is by adding a random query string to the end of the url; this usually bypasses most caches and gives you a “fresh” version of the page. So I put together a simple bookmarklet that reloads the current page your on with a time-stamped query string—resulting in a “fresh” version you can check for problems before purging the old caches.
Nutshell: this bookmarklet reloads your page with a unique query string:
You know the drill: drag it to your bookmark toolbar and click for a minty burst of freshness.
But that bookmarklet is more of a convenience to save you from having to come up with a random string every time. The real headache is when a CDN caches your scripts or stylesheets. Why? Because even if you bring up a fresh version of your page, it’s still calling to the same CSS or Javascript file as the last iteration of your page. And if you’ve made changes to those stylesheets or scripts, you’re not going to see those updates unless you clear the CDN cache or append a query string to those javascript or stylesheet includes.
I looked around for a solution to this and found Jason Beaird’s CSS Cache Busting bookmarklet which proved to be a good starting point, but had to rewrite it to include scripts since I’m constantly getting frustrated with cached scripts as well.
Nutshell: this bookmarklet adds a unique query string to all of the included scripts and stylesheets on your page:
Please take, use, enjoy—hopefully this saves you some time. If you have any feedback or cool tweaks, feel free to post them in the comments!
(Minutia)
- Author:Jesse
- Published:Apr 26, 2011
- Chapters:
- Previous:
- Next:
GetUpdated
ElseWhere
AllChapters
- 2 articles in the chapter Accessibility
- 7 articles in the chapter Announcements
- 1 articles in the chapter App
- 2 articles in the chapter Apple
- 5 articles in the chapter Blogging
- 7 articles in the chapter CMS
- 1 articles in the chapter Code
- 3 articles in the chapter CSS
- 16 articles in the chapter Design
- 2 articles in the chapter DIY
- 4 articles in the chapter Downloads
- 2 articles in the chapter Freebies
- 2 articles in the chapter Gadgets
- 1 articles in the chapter Javascript
- 7 articles in the chapter Journeys
- 1 articles in the chapter Miscellany
- 1 articles in the chapter Mobile
- 59 articles in the chapter Movable Type
- 1 articles in the chapter Photography
- 2 articles in the chapter Plugins
- 1 articles in the chapter Print
- 3 articles in the chapter Projects
- 2 articles in the chapter Reviews
- 2 articles in the chapter SEO
- 10 articles in the chapter Social Networking
- 1 articles in the chapter Standards
- 4 articles in the chapter Writing
ReaderFavorites
- CSS Image Framing
- Tools of the Web Design Trade, Pt.1: Where to Begin
- Social Networking Is Killing My Ability To Write
- 10 Tips For Creating Website Mockups In Photoshop
- MobileMe vs. Dropbox
- Redesign, Part 1: The Logo
- Redesign, Part 2: Stylesheet Philosophy
- The Social Graph in Plain Language
- Writing Your Own Autobiography: The New Persistence of Information

















