Skip to content

Instantly share code, notes, and snippets.

@spjeff
Created August 27, 2020 14:11
Show Gist options
  • Save spjeff/4943f9ac761bc5b8f3fd626a001efede to your computer and use it in GitHub Desktop.
Save spjeff/4943f9ac761bc5b8f3fd626a001efede to your computer and use it in GitHub Desktop.
// from https://stackoverflow.com/questions/827368/using-the-get-parameter-of-a-url-in-javascript
function gup( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment