Bookmarklet to toggle between local and live website

Alec Jacobson

August 14, 2013

weblog/

I administer our groups website and I often work with a local version of the page. Inevitably I end up toggling between the local and live versions of the page. Here's a bookmarklet that switches between addresses starting with localigl and igl.ethz.ch. So if I'm viewing the live page at http://igl.ethz.ch/publications it'll switch to http://localigl/publications:
javascript:(function(){window.location.href=window.location.href.replace(/localigl|igl.ethz.ch/g,function(w){switch(w){case "localigl": return "igl.ethz.ch"; case "igl.ethz.ch": return "localigl";}});})()