Skip to content

Instantly share code, notes, and snippets.

@jaimeguaman
Created August 9, 2013 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaimeguaman/6196226 to your computer and use it in GitHub Desktop.
Save jaimeguaman/6196226 to your computer and use it in GitHub Desktop.
get url action and url parameters javascript
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