1. Technology
Send to a Friend via Email

Referring Site

Join the Discussion

Questions? Comments?

The above line (if there is one) contains the web address of the site that you were on immediately before visiting this page. If you got here by following one of the links on this site then the address of the home page for this site will be displayed. If you came from a search engine then the name of the search engine home page is displayed. If someone is kind enough to link directly to this page from a page on their site then their home page address will be displayed.

There are all sorts of uses that you can put this information to within Javascript processing on your site and the information is easily obtained. The line at the top of this page is displayed with a single line of code.

document.write(document.referrer);

Unfortunately, you can't rely on this information always being provided since whether or not the information gets passed in the first place is under the control of your individual visitors. Most browsers and firewalls contain an option that allows anyone to stop this information being passed and substitutes blanks instead. Browsers also pass blanks in this field if the person types the address of your page into their address bar to go to your page directly instead of following a link from another page.

We can therefore say that if the field contains something then that is the address of the site that the previous page was on. If it is blank then we don't know what site the previous page was on. To avoid annoying those visitors who have chosen to suppress this information you should make sure that your Javascript code does not cause problems when this value is blank.

©2014 About.com. All rights reserved.