14 September 2012
A bookmarklet for jumping between dev and production
Here's a bookmarklet for jumping between different hosts while maintaining the same path. It’s really useful for navigating between the same pages on your development servers, staging servers, and productions servers.
javascript:(function(domain)%7Bvar%20url=window.location.href.split('/');url%5B2%5D=domain;url=url.join('/');window.open(url);%7D)('localhost:8080')
I put the most useful text right at the end, so you can easily change it for any host you like! I have two variations of this bookmarklet in a folder in my bookmarks bar called “onLocal” and “onProd”.
If copy and paste isn’t your bag, then use this nifty tool to generate your own versions of the bookmarklet…
Enter a hostname and a title for your bookmarklet and drag the resulting link to your bookmarks bar:
Also, if you’d rather write your own bookmarklets, then give my bookmarklet generator a try.