469,909 Members | 1,653 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

PHP equivalent to javascript window history?

Is there a PHP equivalent to the javascript statement history.go(-1)?

Thanks!

Larry
Jul 17 '05 #1
4 3696
Larry Kahm wrote:
Is there a PHP equivalent to the javascript statement history.go(-1)?


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/
Jul 17 '05 #2
"Larry Kahm" <lkahm@nospam_bellatlantic.net> wrote in message
news:8UTfd.11195$PZ4.7264@trndny07...
Is there a PHP equivalent to the javascript statement history.go(-1)?

Thanks!

Larry


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.
Jul 17 '05 #3
rw
OO Command pattern i think.
rw
Larry Kahm wrote:
Is there a PHP equivalent to the javascript statement history.go(-1)?

Thanks!

Larry

Jul 17 '05 #4
>>>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" <bl*******@electrictoolbox.com> wrote in message
news:10**************@216.128.74.129...
Larry Kahm wrote:
Is there a PHP equivalent to the javascript statement history.go(-1)?


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/
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nicki Pittman | last post: by
5 posts views Thread by TrvlOrm | last post: by
3 posts views Thread by Jake | last post: by
8 posts views Thread by Alex D. | last post: by
4 posts views Thread by fredd00 | last post: by
3 posts views Thread by anthonybrough | last post: by
1 post views Thread by George | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.