Document.referrer

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

Syntax

var referrer = document.referrer;

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 same value as the href of the parent window's Window.location.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'document.referrer' in that specification.
Living Standard

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
referrerChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0

Legend

Full support
Full support