HTML DOM referrerProperty
Document Object
Definition and Usage
The referrer property returns the URL of the document that loaded the current document.
If the current document is not accessed via a hyperlink, it is null. This property allows client-side JavaScript to access the HTTP referrer header.
Syntax
document.referrer
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the referrer property.
Example
Example
Return the source URL of the current document:
<html>
<body>
The referrer address of this document:
<script>
document.write(document.referrer);
</script>
</body>
</html>
<body>
The referrer address of this document:
<script>
document.write(document.referrer);
</script>
</body>
</html>
Try it Yourself »
Document Object Other Extensions