Click to See Complete Forum and Search --> : I need to know where they come from
opilander
11-21-2002, 04:03 AM
Hi! I'm a beginner in this area but somebody told me what I want can be done with Java. What I want is: a link that only appears on a webpage if the person viewing the page has arrived from outside my domain. If the person has reached the page from within my domain no link is to be showed. Is this possible? Can anyone help me with this?
Thanks,
Petter Ilander, Finland
Vladdy
11-21-2002, 07:06 AM
Since you are posting on JavaScript forum I assume you are looking for a client-side code. The more reliable way to accomplish the task is using server side scripting so it works regardless of javascript being enabled.
If for some reason server side implementation is not possible, you can do the following:
give the link you are trying to hide an id
use onload event to examine the document.referrer
if it matches your URL then use getElementById to access the link and [element].removeNode to get rid of it. You can also use [element].style.visibility to hide it, if removing the node affects your document flow.
opilander
11-21-2002, 08:09 AM
Yeah. I guess you're right, Dave. I've only copied and pasted JavaScript so far, and although vladdy's answer seems to be just what I want, I can't write the script:(
Is it too much to ask, or could somebody please help and show me how to write the script?
The pages concerned are: www.uwasa.fi/~h79188/artikkelit/aminohappo.html
which is the page that should have a link to:
www.uwasa.fi/~h79188/artikkelit.html when people come from outside of my domain but not when from inside it.
Thanks!!