Referrer of a page by document referrer propertyThe value of referrer became important as it gives information about the source of traffic to a site. Some time referrer value is used to redirect visitors to different pages based on requirement. Here is an example of code to get the referrer by using JavaScript document object.
Here is the output ( if your browser referrer is available )
Use the menu in left and arrive at this page from different pages and check how the referrer value changes. Please note that it is not possible to always get the referrer value from the visitor browser even if the visitor has clicked a valid link and arrived at the page. Referrer value can be prevented from carrying by the browser settings. In Firefox how to change referrer setting of the browser is explained here. Referrer can be found out by using server side scripts also. You can read how to get referrer in PHP here and how to get referrer value in ASP here. Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
![]() |
![]() |