THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM referrer Property

Document Object Reference Document Object

Example

Return the referrer of the current document:

var x = document.referrer;

The result of x will be:

Try it Yourself »

Definition and Usage

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


Browser Support

Property
referrer Yes Yes Yes Yes Yes

Syntax

document.referrer

Technical Details

Return Value: A String, representing the URL of the document that loaded the current document. Returns the entire URL, including the protocol (like http://). If the current document was not opened through a link (for example, through a bookmark), an empty string is returned.
DOM Version Core Level 2 Document Object

Document Object Reference Document Object