Bookmarklet: load local test script

Working on a data-loading application for a client, I got involved in some debugging work more complex than I was ready to handle with Firebug’s console. Access controls limited the problem script to running on the remote server, and (as I quickly tired of uploading new diagnostics) I went looking for a way to manipulate the test environment from my development computer. My answer was to create a mini-bookmarklet that would load and re-load a local test script, allowing me to update the test without needing to refresh the browser. So, in the proud tradition of bookmarklet design,

javascript:(function(){
  var script=document.createElement('script');
      script.src = encodeURI(
        '<strong>http://localhost/test-script.js</strong>?v='+Math.random()
      );
  document.body.appendChild(script);
})();

To use this with your own tests, simply change the base path of the script (test-script.js in the example above) and paste a compressed version of the entire bookmarklet into your browser bar.

Let’s keep in touch

Get noise-free updates on software, product, and process.

Hey, I'm RJ: digital entomologist and intermittent micropoet, writing from the beautiful Rose City.