Created
August 9, 2013 19:01
-
-
Save jaimeguaman/6196226 to your computer and use it in GitHub Desktop.
get url action and url parameters javascript
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
function getURLAction(action){ | |
var posibleAction=window.location.hash.replace(/^#\/?/, ""); | |
posibleAction=posibleAction.substring(0,posibleAction.indexOf('?')); | |
return posibleAction==action ? true : false | |
} | |
function getURLParameter(name,inHashSearch){ | |
var searchScope=inHashSearch ? window.location.hash : location.search; | |
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(searchScope)||[,""])[1].replace(/\+/g, '%20'))||null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment