SyntaxHighlighter

Monday, July 29, 2013

A Bookmarklet for switching between localhost and production

If you are often going between production and localhost:3000 - you can easily change the domain name with a simple javascriptlet - something like this...

javascript:a=document.location.href.match(/http:\/\/([^\/]+)\/(.+)/);if(a[1].match(%22exampledomain%22)){document.location=%22http://localhost:3000/%22%20+%20a[2]}else{document.location=%22http://www.exampledomain.com/%22%20+%20a[2]}

 Make this the content of a bookmark, and add it to your bookmark menu.  Easy flipping.

Adjust further if you need to go between a staging environment or another localhost domain.

No comments:

Post a Comment