Skip to content

Instantly share code, notes, and snippets.

@anthonyec
Last active September 5, 2018 08:12
Show Gist options
  • Save anthonyec/d48696d8e0b53e93a9d7c80f52e66c7e to your computer and use it in GitHub Desktop.
Save anthonyec/d48696d8e0b53e93a9d7c80f52e66c7e to your computer and use it in GitHub Desktop.
WWW to Sandbox
(function() {
var currentLocation = location.href;
var currentLocationHasWww = currentLocation.indexOf('www.') !== -1;
var searchValue = currentLocationHasWww ? 'www.' : 'sandbox.';
var replacement = currentLocationHasWww ? 'sandbox.' : 'www.';
window.location = location.href.replace(searchValue, replacement);
})();
{
"name": "Toggle Sandbox",
"description": "Toggle between www. and sandbox. subdomains"
}
javascript:(function()%7B!function()%7Bvar%20w%3D-1!%3D%3Dlocation.href.indexOf(%22www.%22)%2Co%3Dw%3F%22www.%22%3A%22sandbox.%22%2Cn%3Dw%3F%22sandbox.%22%3A%22www.%22%3Bwindow.location%3Dlocation.href.replace(o%2Cn)%7D()%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment