document Properties Object Properties Summary
Retrieves the URI of the previous location.
HTML |
N/A |
Script |
[ sUrl = ] document.referrer |
sUrl |
String specifying the URL of the referring page. |
The property is read-only with no default value.
This attribute returns the URI of the page that linked to this page. The property only returns a value when the current page has been reached through a link from the previous page.
Otherwise, document.referrer returns an empty string in the following cases:
- if the user navigated to the page directly and not through a link, for example, via a bookmark.
- it will also return empty when the link is from a secure site.
For example, if PageA.html has a link to PageB.html, and the user clicks the link on PageA.html to go to PageB.html, the document.referrer on PageB.html will return "PageA.aspx". However, if the user is on PageA.html and types PageB.html into the address line or uses Open in the File menu to get to PageB.html, the document.referrer will return empty.
document