RSS

Blog posts tagged with 'referrer'

How to redirect users based on referrer URL using JavaScript

Written by Lavish Kumar

written by Lavish Kumar

In this tutorial, you will learn how you can redirect users on your website based on referrer URL using JavaScript. According to W3Schools, "document.referrer" returns a string, representing the URL of the document that loaded the current document. Returns the entire URL, including the protocol (like http://). If the current document was not opened through a link (for example, through a bookmark), an empty string is returned.

This solution can check if the user (site traffic) is coming from a specific webpage or a website URL and based on that it will redirect the users accordingly.

Let's dive in!