Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

history.go("URL") doesnt work

Question posted by: Harald Weiser (Guest) on July 20th, 2005 02:36 PM
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


Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Michael Winter's Avatar
Michael Winter
Guest
n/a Posts
July 20th, 2005
02:36 PM
#2

Re: history.go("URL") doesnt work
On Mon, 16 Feb 2004 13:30:00 +0100, wrote:
[color=blue]
> I use the following string to go back to a page that's in the history.
> <A HREF="javascript:history.go('dosearch=0')">[/color]

The method, History.go(), expects an integer, not a string.

On a different matter, read:

http://www.jibbering.com/faq/#FAQ4_24

Mike

--
Michael Winter
Join Bytes!lid (replace ".invalid" with ".uk" to reply)

rgee_f's Avatar
rgee_f
Guest
n/a Posts
July 20th, 2005
02:37 PM
#3

Re: history.go("URL") doesnt work
"Harald Weiser" <hawe@domea[remove].com> wrote in message news:<c0qd26$ia5$1@paperboy.Austria.EU.net>...[color=blue]
> 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[/color]


Try this:

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

HTH

Harald Weiser's Avatar
Harald Weiser
Guest
n/a Posts
July 20th, 2005
02:37 PM
#4

Re: history.go("URL") doesnt work

"rgee_f" <neprouto8w@jetable.org> schrieb im Newsbeitrag
news:bc84d542.0402161655.4d45d5c2@posting.google.c om...[color=blue]
> Try this:
>
> <a href="javascript:history.go(-1)"> return to previous page</a>
>
> HTH[/color]

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



Evertjan.'s Avatar
Evertjan.
Guest
n/a Posts
July 20th, 2005
02:37 PM
#5

Re: history.go("URL") doesnt work
Harald Weiser wrote on 17 feb 2004 in comp.lang.javascript:
[color=blue]
>
> "rgee_f" <neprouto8w@jetable.org> schrieb im Newsbeitrag
> news:bc84d542.0402161655.4d45d5c2@posting.google.c om...[color=green]
>> Try this:
>>
>> <a href="javascript:history.go(-1)"> return to previous page</a>
>>
>> HTH[/color]
>
> 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...[/color]

No,

use this:

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


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Brian Genisio's Avatar
Brian Genisio
Guest
n/a Posts
July 20th, 2005
02:37 PM
#6

Re: history.go("URL") doesnt work
Harald Weiser wrote:

[color=blue]
> 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...[/color]

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


Randy Webb's Avatar
Randy Webb
Guest
n/a Posts
July 20th, 2005
02:38 PM
#7

Re: history.go("URL") doesnt work
Evertjan. wrote:[color=blue]
> Harald Weiser wrote on 17 feb 2004 in comp.lang.javascript:
>
>[color=green]
>>"rgee_f" <neprouto8w@jetable.org> schrieb im Newsbeitrag
>>news:bc84d542.0402161655.4d45d5c2@posting.google.c om...
>>[color=darkred]
>>>Try this:
>>>
>>><a href="javascript:history.go(-1)"> return to previous page</a>
>>>
>>>HTH[/color]
>>
>>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...[/color]
>
>
> No,
>
> use this:
>
> <a href="javascript:location.href=URL">
> return to specified previous page</a>
>
>[/color]

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



--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/


 
Not the answer you were looking for? Post your question . . .
183,630 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors