Testing JavaScript library updates with remote mappings in Charles

Charles Proxy is an incredibly useful but still not widely known tool for web developers. One of its features lets us map URLs from one location to another. With remote mapping enabled, the web browser sends out a request for one file, but receives a different file in return.

One useful application of remote mappings is testing updated versions of JavaScript libraries. If your website is running jQuery 1.5.1, you could set up a mapping to quickly and easily test jQuery 1.7.2. You would simply tell Charles to map http://your-site.com/js/jquery-1.5.1.min.js to http://code.jquery.com/jquery-1.7.2.js.

Then when you visited your website, you could see how it would run with the newer version of jQuery. No server-side changes required!

Setting up a remote mapping for jQuery

This is an extract from my presentation at the Melbourne Web Developers meetup yesterday.