The javascript function below returns an array/object with the parameters and values of the current url variables.
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
Ex:http://leituracrista.com/audioplayer/player.html?ip=dispensacao#15&site=leituracrista
calling the function getUrlVars(), considering the above url, we will have the following return:
{
"ip" : "dispensacao#15",
"site" : "leituracrista"
}
to take the value of the first parameter would be like this:
var first = getUrlVars()["ip"]; //dispensacao#15
the second:
var second = getUrlVars()["site"]; //leituracrista
Source
Works like a Charm! Thank you very much
– Miguel Silva
Boleta show.
– Gato de Schrödinger