Gets the URL of the location that referred the user to the current document.
Note: This property is read-only.
var referrerURL = document.referrer;
Returns an object of type StringString
The URL of the referring document, or an empty string.
- It returns a value only when the user reaches the current document through a link from the previous document. Otherwise, it returns an empty string.
For example, if DocumentA.htm includes a link to DocumentB.htm, and the user clicks that link, the
document.referrer on DocumentB.htm returns “DocumentA.htm.” However, if the user is on DocumentA.htm and types DocumentB.htm into the address line or using some kind of “Open” method of the browser to get to DocumentB.htm, it returns the empty string.
- It also returns an empty string when the link is from a secure site.
- DOM Level 2 HTML
Microsoft Developer Network: [Windows Internet Explorer API reference Article]