Name

referrer — NN 2 IE 3 DOM 1

Synopsis

Read-only

Returns a string of the URL of the page from which the current page was accessed, provided the original page had a link to the current page. Many server logs capture this information as well. Scripts can see whether the visitor reached the current document from specific origins and perhaps present slightly different content on the page accordingly. If the visitor arrived by another method, such as typing the document URL into a browser dialog or by selecting a bookmark, the referrer property returns an empty string.

Example

if (document.referrer) {
    document.write("<P>Thanks for following the link to our web site.</P>")
}

Value

String.

Default

None.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.