Tag Archives: document.referrer

Get the User Referrer via JavaScript

Hi,

You van get the user referrer via javascript using the following code:

document.referrer

The said code will give you the full url path to which your user came from.

Example is http://google.com/?some-strings=goes-here

So you can check if its from a user from a google with a particular search string.

 

Just a Note. It can also received the same domain to which your site is in. For an instance your domain is http://domain.com then you referesh the page, the said code will return http://domain.com because you just refresh the page.