codice:
if (document.referrer) { location.assign(document.referrer); }
oppure:
codice:
if (document.referrer) { location.replace(document.referrer); }
oppure:
codice:
location.assign(document.referrer || "http:\/\/www.google.com\/");
oppure:
codice:
location.replace(document.referrer || "http:\/\/www.google.com\/");
A seconda di cosa scegli l'effetto sarà leggermente diverso…
Poi, se vuoi leggere anche le querystring tramite js:
codice:
var oGetVars = new (function (sSearch) {
var rNull = /^\s*$/, rBool = /^(true|false)$/i;
function buildValue(sValue) {
if (rNull.test(sValue)) { return null; }
if (rBool.test(sValue)) { return sValue.toLowerCase() === "true"; }
if (isFinite(sValue)) { return parseFloat(sValue); }
if (isFinite(Date.parse(sValue))) { return new Date(sValue); }
return sValue;
}
if (sSearch.length > 1) {
for (var aItKey, nKeyId = 0, aCouples = sSearch.substr(1).split("&"); nKeyId < aCouples.length; nKeyId++) {
aItKey = aCouples[nKeyId].split("=");
this[unescape(aItKey[0])] = aItKey.length > 1 ? buildValue(unescape(aItKey[1])) : null;
}
}
})(window.location.search);
// alert(oGetVars.yourVar);