Skip to content

Instantly share code, notes, and snippets.

@jlaundry
Created February 18, 2023 20:42
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 jlaundry/c7d2218e98a7a59208dc36e842a759bb to your computer and use it in GitHub Desktop.
Save jlaundry/c7d2218e98a7a59208dc36e842a759bb to your computer and use it in GitHub Desktop.
function getHashParams() {
/**
* Get the page hash parameters
* @return {Object} a dict of key=value pairs from location.hash
*/
let params = {};
let vars = location.hash.substring(1).split('&');
for (let i = 0; i < vars.length; i++) {
let kv = vars[i].split('=');
params[kv[0]] = kv[1];
}
return params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment