Categories
JavaScript Answers

How to get the referrer with JavaScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *