HTML DOM Document referrer Property

Definition and Usage

referrer The property returns the URL of the document that loaded the current document.

referrer The property is read-only.

Example

Returns the referrer of the document:

document.referrer;

Try it yourself

Syntax

document.referrer

Return value

Type Description
String

The URL of the document that loaded the current document.

Returns an empty string if the document is not opened through a link.

Browser support

document.referrer It is a feature of DOM Level 2 (2001).

All browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support