
September 13th, 2002, 04:29 PM
|
|
Contributing User
|
|
Join Date: Aug 2002
Location: Nuevo Mexico, U.S.
Posts: 86
Time spent in forums: 1 h 26 m 38 sec
Reputation Power: 6
|
|
|
Need to see if "referrer" is inside/outside my site
I need to find out if someone has accessed my site's main page from outside my entire site or from a page within my site. What's the most straightforward way to do this? Should I just see if my domain's URL is found in the document.referrer property?
if (document.referrer&&document.referrer!="")
{
if (document.referrer.indexOf("https://www.mydomain.com")>=0)
{
...visitor came from within my site...
}
else
{
...visitor came from outside my site...
}
}
How does that look?...0 being the first position in the string. And can someone tell exactly why the line (document.referrer&&document.referrer!="") is always used when this property is referred to? Wouldn't document.referrer!="" suffice? Does it translate in English to "not null AND not empty" or something?
UPDATE TO POST: I started by putting code on a page to display the document.referrer. When I key it into my Yahoo Store Editor it works perfectly displaying actual web URLS of the editor itself. When I "publish" the page on the net, the page just gives me nothing but a "blank page". It's like the document.referrer property is always null. Currently stumped.
Last edited by Chiles4 : September 13th, 2002 at 05:10 PM.
|