history.go("URL") doesnt work

H

Harald Weiser

Hi you out there.

I use the following string to go back to a page that's in the history.
<A HREF="javascript:history.go('dosearch=0')">

But nothing happens. Using the complete URL makes no difference :-(

Suggestions?

THX, Harry
 
R

rgee_f

Harald Weiser said:
Hi you out there.

I use the following string to go back to a page that's in the history.
<A HREF="javascript:history.go('dosearch=0')">

But nothing happens. Using the complete URL makes no difference :-(

Suggestions?

THX, Harry


Try this:

<a href="javascript:history.go(-1)"> return to previous page</a>

HTH
 
H

Harald Weiser

rgee_f said:
Try this:

<a href="javascript:history.go(-1)"> return to previous page</a>

HTH

I know this one, but then I would have to remember how many pages a called
since then... And I read that with go you can give a location as
parameter...

Harry
 
E

Evertjan.

Harald Weiser wrote on 17 feb 2004 in comp.lang.javascript:
I know this one, but then I would have to remember how many pages a
called since then... And I read that with go you can give a location
as parameter...

No,

use this:

<a href="javascript:location.href=URL">
return to specified previous page</a>
 
B

Brian Genisio

Harald Weiser wrote:

I know this one, but then I would have to remember how many pages a called
since then... And I read that with go you can give a location as
parameter...

My refrerence says the same thing (JavaScript Bible by Danny Goodman):

go(relativeNumber | "URLOrTitleSubstring")

Which tells me that _some_ browsers will support a URL or Title
substring, IF AND ONLY IF the value exists in the history already.

The IE reference says the following about the parameter:

"[The parameter] specifies an integer or a string. An integer indicates
the relative position of a URL in the History list. A string indicates
an exact URL in the History list."

This is different than saying
[document|window].location.href="newPlace", because it effects the
history differently.

Still, the value must exist in the history (not the cache), meaning you
must be able to navigate to it via forward and back. Note that there is
some security in the history model... you cannot see what is in it... to
avoid prying eyes from watching your every move :)

Brian
 
R

Randy Webb

Evertjan. said:
Harald Weiser wrote on 17 feb 2004 in comp.lang.javascript:




No,

use this:

<a href="javascript:location.href=URL">
return to specified previous page</a>

<a href="howToUseTheBackButton.html" onclick="location.href=URL">
return to specified previous page</a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top