PDA

View Full Version : tracking links


Bluemonkey
09-02-2002, 10:15 AM
how can i track a link so if i go to bob1.htm from bob.htm the back button says "bob.htm" and if i go to bob2.htm the back to say "../bob.htm"

thanks for the help

redhead
09-02-2002, 06:52 PM
not too sure what your asking... but is this it?

<a href="javascript:history.back()">Back</a>

:cool:

edit: if you want it to go back more than one page then put history.back(2) or whatever... although that could get confusing, the only way to physically track what links are clicked would be server-side.

MCookie
09-02-2002, 07:47 PM
Actually, if that's what you want, it's

<a href="javascript:history.go(-1);">Back</a>

for going one page back and (-2) for two steps back...

<edit>That's without the space between java and script. Don't know why this forum does that...</edit>

redhead
09-02-2002, 08:51 PM
nah... as MCookie said, that is another way of doing the same thing ;). history.back() is made for going back, history.go() is for going forward... but in the same way if you wanted to go forward you could use either history.go() or history.back(-1)... (dunno which is more browser complatable though)

either'll do :thumbsup:

Bluemonkey
09-03-2002, 09:09 AM
sorry that first post might have been a bit confusing

right i want two pages bob1.htm and bob2.htm both have a link to bob.htm.
on bob.htm i want a back button that if you came form bob1.htm to say <a href="onelink.htm">Back</a>

and if you came from bob2.htm to say
<a href="anotherlink.htm">Back</a>

sorry for confusing u

thanks for the help

Nightfire
09-03-2002, 02:32 PM
You're gonna have to put the links in yourself, unless javascript can somehow do it. The best way and easiest would be using a serverside method.

x_goose_x
09-03-2002, 02:40 PM
Try this:

http://www.codingforums.com/showthread.php?s=&threadid=5404

Just set the history length to 1 if you want it to only show the last page.

jerkin
09-04-2002, 04:52 PM
Originally posted by redhead
nah... as MCookie said, that is another way of doing the same thing ;). history.back() is made for going back, history.go() is for going forward... but in the same way if you wanted to go forward you could use either history.go() or history.back(-1)... (dunno which is more browser complatable though)

either'll do :thumbsup:

intresting usage :)