HTML DOM Document referrer

Example

Return the referrer of the document:

document.referrer;
Try it Yourself »

Description

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

The referrer property is read-only.


Syntax

document.referrer

Return Value

Type Description
StringThe URL of the document that loaded the current document.
If the document was not opened with a link, an empty string is returned.

Browser Support

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

It is fully supported in all browsers:

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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.