Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic javascript help, document.referrer

Status
Not open for further replies.

UncleMortis

Programmer
Jan 28, 2003
120
AU
I'm having trouble with a document.referrer. The book tells me that when I have this on a page with an "a href" html tag, it will send it back to the page that I had originally came from or, if there is no referring page, then it will come back blank. The problem I've encountered is that when I do click the link to take me back to the referring page, it doesn't and it actually takes me back to the folder where the files are living.

document.write (&quot;Go <a href=&quot;+document.referrer+&quot;> back</a> one page.&quot;)
 
try this in a function...

document.location=document.referrer.URL

and in the link...

<a href=&quot;#null&quot; onClick=&quot;javascript: fncName();&quot;>

Later,
Greelmo
 
You might find ...

Code:
<a HREF=&quot;javascript:history.back()&quot;>

to be a better fit for your purposes, and simpler.
 
Yeah I've got the history bit and I thought that'd fit better in what I was trying to do but from what I can gather, history is only going to tell me how many pages I've been to before I've reached the one I'm at. can anyone tell me why the document.referrer would go and open the folder from where it originated and not go back like it said it would in the book? I can't go on until I've worked this out because I don't want to get miles into the book and then go, &quot;huh?&quot;. Thanks guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top