document.referrer : Referrer URL of a page

<script language="javascript">
var ref=document.referrer;
document.write('You have arrived from<BR> '+ref)
</script>
Here is the output (URL) ( if your browser referrer is available )
We have used document.referrer property to get the referrer to this page. What is a referrer ?

Very basic answer is how you have arrived at this page. You could have clicked a link in some other page of this site or some other site.

Search engine

You could have searched for a key word in search engine and clicked a link at search result page to arrive at this page. In this case the search engine page has became the referrer for this page. But if you have typed the address or url of this page in the address bar of your browser and opened this page then there is no referrer and the value of referrer became blank or null.

The 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.

Use the top menu 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.
document Object Title of the Page
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer