Document Referrer

[Total: 0    Average: 0/5]

This shows how to use the document.referrer object.

Body Code:

function doIt()
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();
<a href="javascript:doIt()">click to see referrer in an alert</a>
<a href="javascript:doThis()">click to reload page</a>
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).
Note: IE depricated this is version 3+.  There is no other means to obtain
this information with IE.

Times Viewed: 124

Leave a Reply

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