Skip to content

Instantly share code, notes, and snippets.

@hisui
Created June 18, 2015 01:08
Show Gist options
  • Select an option

  • Save hisui/81dffe5c331c3badcda1 to your computer and use it in GitHub Desktop.

Select an option

Save hisui/81dffe5c331c3badcda1 to your computer and use it in GitHub Desktop.
function getPageQuery() {
var parts = window.location.search.substring(1).split("&");
var query = {};
for (var i = 0; i < parts.length; ++i) {
var pair = parts[i].split("=");
if (pair.length == 2) {
query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
}
}
return query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment