Sometimes, we want to get the referrer with JavaScript.
In this article, we’ll look at how to get the referrer with JavaScript.
How to get the referrer with JavaScript?
To get the referrer with JavaScript, we use the document.referrer
property.
For instance, we write
const referrer = document.referrer;
to get the referrer of the current page.
Conclusion
To get the referrer with JavaScript, we use the document.referrer
property.