Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP equivalent to javascript window history?

Larry Kahm
Guest
 
Posts: n/a
#1: Jul 17 '05
Is there a PHP equivalent to the javascript statement history.go(-1)?

Thanks!

Larry



Chris Hope
Guest
 
Posts: n/a
#2: Jul 17 '05

re: PHP equivalent to javascript window history?


Larry Kahm wrote:
[color=blue]
> Is there a PHP equivalent to the javascript statement history.go(-1)?[/color]

No! PHP is server-sided so has no concept whatsoever of the browser's
history.

The closest you can get to it is using $_SERVER['HTTP_REFERER'] but this is
extremely unreliable as it is often blocked by the user. The other problem
is that going "back" using this method is really forward as far as the
browser is concerned, so after using it the first time you would just keep
toggling back and forward between the same two pages.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Chung Leong
Guest
 
Posts: n/a
#3: Jul 17 '05

re: PHP equivalent to javascript window history?


"Larry Kahm" <lkahm@nospam_bellatlantic.net> wrote in message
news:8UTfd.11195$PZ4.7264@trndny07...[color=blue]
> Is there a PHP equivalent to the javascript statement history.go(-1)?
>
> Thanks!
>
> Larry
>[/color]

Nope. But it's easy enough to implement something like that yourself by
pushing the current URL into a session array in some globally included file.


rw
Guest
 
Posts: n/a
#4: Jul 17 '05

re: PHP equivalent to javascript window history?


OO Command pattern i think.
rw
Larry Kahm wrote:[color=blue]
> Is there a PHP equivalent to the javascript statement history.go(-1)?
>
> Thanks!
>
> Larry
>
>[/color]
Larry Kahm
Guest
 
Posts: n/a
#5: Jul 17 '05

re: PHP equivalent to javascript window history?


>>>No! PHP is server-sided so has no concept whatsoever of the browser's
history.

D'OH! - I've read it before. Now I get it!

Thanks!

Larry

"Chris Hope" <blackhole@electrictoolbox.com> wrote in message
news:1098910838_51291@216.128.74.129...
Larry Kahm wrote:
[color=blue]
> Is there a PHP equivalent to the javascript statement history.go(-1)?[/color]

No! PHP is server-sided so has no concept whatsoever of the browser's
history.

The closest you can get to it is using $_SERVER['HTTP_REFERER'] but this is
extremely unreliable as it is often blocked by the user. The other problem
is that going "back" using this method is really forward as far as the
browser is concerned, so after using it the first time you would just keep
toggling back and forward between the same two pages.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/


Closed Thread