Skip to content

Instantly share code, notes, and snippets.

@Cam
Created October 6, 2016 23:16
Show Gist options
  • Save Cam/c960b7a20704547970dab3c4543c0ba1 to your computer and use it in GitHub Desktop.
Save Cam/c960b7a20704547970dab3c4543c0ba1 to your computer and use it in GitHub Desktop.
Get All URL Parameters
// Check each URL parameter
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
// Set each URL paramater variable
var refrr = GetURLParameter('refrr'); // where refrr is example paramater
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment