Document Referrer

[Total: 0    Average: 0/5]

This shows how to use the document.referrer object.

Body Code:

<script>
document.write("document.referrer="+document.referrer+"<BR>");
document.write("document.location="+document.location+"<BR>");
function doIt()
{
alert("document.referrer="+document.referrer);
}
function doThis()
{
var _a = document.location.toString();
var _l = _a.indexOf("?")==-1?_a.length:_a.indexOf("?");
    _a = _a.substr(0,_l);
	_a += "?"+Math.random(100).toString();
document.location=_a;
}
</script>
<a href="javascript:doIt()">click to see referrer in an alert</a>
<BR>
<a href="javascript:doThis()">click to reload page</a>
<BR>
Note: The referrer object is only set when a link from page A to page B
is clicked, and only if the server to web browser communication includes
that data (it is not required by the http protocol).
<BR>
Note: IE depricated this is version 3+.  There is no other means to obtain
this information with IE.

Times Viewed: 9

Leave a Reply

Your email address will not be published. Required fields are marked *