Skip to content

Instantly share code, notes, and snippets.

@shrunyan
Last active May 21, 2018 11:10
Show Gist options
  • Save shrunyan/6190080 to your computer and use it in GitHub Desktop.
Save shrunyan/6190080 to your computer and use it in GitHub Desktop.
Javascript function which returns an Array of all URL parameters.
/**
* Returns an Array of all url parameters
* @return {[Array]} [Key Value pairs form URL]
*/
function getAllUrlParams() {
var keyPairs = [],
params = window.location.search.substring(1).split('&');
for (var i = params.length - 1; i >= 0; i--) {
keyPairs.push(params[i].split('='));
};
return keyPairs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment