Purl

Costas

Administrator
Staff member
A JS utility for for parsing URLs and extracting information out of them.

https://github.com/allmarkedup/purl

//or

JavaScript:
//read event ID
var eventname = GetURLParameter('event');

////////////////////////
//read 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];
		}
	}
}
 
Top