Last active
May 21, 2018 11:10
-
-
Save shrunyan/6190080 to your computer and use it in GitHub Desktop.
Javascript function which returns an Array of all URL parameters.
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
/** | |
* 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