Document: referrer property

The Document.referrer property returns the URI of the page that linked to this page.

Value

The value is an empty string if the user navigated to the page directly (not through a link, but, for example, by using a bookmark). Because this property returns only a string, it doesn't give you document object model (DOM) access to the referring page.

Inside an <iframe>, the Document.referrer will initially be set to the href of the parent's Window.location in same-origin requests. In cross-origin requests, it's the origin of the parent's Window.location by default. For more information, see the Referrer-Policy: strict-origin-when-cross-origin documentation.

Specifications

Specification
HTML Standard
# dom-document-referrer-dev

Browser compatibility

BCD tables only load in the browser