Connecting Tech Pros Worldwide Help | Site Map

PHP equivalent to javascript window history?

  #1  
Old July 17th, 2005, 10:20 AM
Larry Kahm
Guest
 
Posts: n/a
Is there a PHP equivalent to the javascript statement history.go(-1)?

Thanks!

Larry


  #2  
Old July 17th, 2005, 10:20 AM
Chris Hope
Guest
 
Posts: n/a

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/
  #3  
Old July 17th, 2005, 10:20 AM
Chung Leong
Guest
 
Posts: n/a

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.


  #4  
Old July 17th, 2005, 10:20 AM
rw
Guest
 
Posts: n/a

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]
  #5  
Old July 17th, 2005, 10:20 AM
Larry Kahm
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.javascript FAQ - 7.9 - 2003-06-30 FAQ Poster answers 2 July 20th, 2005 09:51 AM