Snippets

Create an account or login to be able to add, comment and rate snippets.

Navigation

Bookmarklet to toggle between dev & prod environments

The following bookmarklet toggles between the dev and prod environments. It simply does that by adding or removing the '_dev' suffix before the first ".php" of the URL.

javascript:var parts=location.pathname.match(/(.*?)(_dev)?(\.php.*)/);location.pathname=parts[1]+(parts[2]?'':'_dev')+parts[3]
by Michel D'HOOGE on 2007-08-31, tagged bookmarklet  debug 

Comments on this snippet

gravatar icon
#1 david g on 2007-08-31 at 10:56

Hey,

I think this is really cool idea! I edited the code, so it switches from "frontend_dev.php" to "index.php" and the other way round:

javascript:var parts=location.pathname.match(/(.?)(_dev)?(.php.)/);if(parts[2]){location.pathname=parts[1].replace(/frontend/g, 'index')+parts[3]}else{location.pathname=parts[1].replace('index', 'frontend')+(parts[2]?'':'_dev')+parts[3] }

You need to create an account or log in to post a comment or rate this snippet.