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 |
---|
HTML Standard (HTML) # dom-document-referrer-dev |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
referrer |
1 |
12 |
1 |
4 |
3 |
1 |
1 |
18 |
4 |
10.1 |
1 |
1.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer