Last updated on May 20th, 2016 at 03:45 pm

HTTP referrer using Javascript

This is another simple script to get the HTTP referrer using javascript. It will help you in getting the referrer, The page from which your current web page got loaded. Use JavaScript’s referrer property to find out where your visitor came from.

<script LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> 
<!-- Hide script from old browsers
	if (document.referrer != '') 
   	alert('This webpage was referred from ' + document.referrer); 
//-- Stop hiding script --> 
</script> 

As you can see we are using document.referrer which is one of the Javascript useful properties that gives you the URI of the page linked to the current page.

Leave a Reply

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