Skip to content

Instantly share code, notes, and snippets.

@shaosh
Created August 23, 2017 16:54
Show Gist options
  • Save shaosh/f0b3361b0ba61efdd0f7ec60df91f62e to your computer and use it in GitHub Desktop.
Save shaosh/f0b3361b0ba61efdd0f7ec60df91f62e to your computer and use it in GitHub Desktop.
Para query strings in the url
function getUrlParams() {
var result = {};
var params = (window.location.search.split('?')[1] || '').split('&');
for(var param in params) {
if (params.hasOwnProperty(param)) {
paramParts = params[param].split('=');
result[paramParts[0]] = decodeURIComponent(paramParts[1] || "");
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment