Last active
September 24, 2016 00:25
-
-
Save vishnun/c926f14dfbe497d3a16d to your computer and use it in GitHub Desktop.
FailSafe for project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: function failsafe() { | |
if(location.href.indexOf('failsafe')==-1){ | |
if (location.href.indexOf('?') == -1) { | |
location.href = location.href.concat("?failsafe=true"); | |
}else{ | |
location.href = location.href.concat("&failsafe=true"); | |
} | |
} else { | |
var href = location.href.replace("failsafe=true",""); | |
if(location.href.lastIndexOf("&") === location.href.length-1){ | |
href = location.href.replace("&",""); | |
} | |
if(href.lastIndexOf("?") === href.length-1){ | |
href = href.replace("?",""); | |
} | |
location.href = href; | |
} | |
}; failsafe(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment