Page 1 of 1

Detect a Browser Back/Forward by PHP

Posted: Mon Nov 13, 2006 9:14 am
by sahaja108
Hello.
I am developing a dynamic bread crumbs navigation system that was working fine until I came across the fatul "back and forward" that made it break. :(
SOS.
I was wondering if it possible to detect a Browser Back/Forward by PHP.
I mean. I am in page A, I go to page B and then I click on the Back button and I return to A.
Does it exist a php function that detect that I have used the Back button?

Thank you very much :D

Sahaja

Posted: Mon Nov 13, 2006 9:24 am
by m3mn0n
PHP is server-side... and it seems as though you're trying to solve a client-side issue... I'd suggest looking at JavaScript as tool for this.

Posted: Mon Nov 13, 2006 9:55 am
by sahaja108
thanks for the raply m3mn0n,

the problem is more complicated than what i depicted!

after your advice, i tested the system. practically, if i use Firefox and Explorer, the browser call the page from the server, but Opera not!
i have used a

echo rand();

and it returns different values for FF and IE when a i go back and forward, but the same value ion Opera!

Posted: Mon Nov 13, 2006 1:02 pm
by RobertGonzalez
You cache control settings can have an impact on what the browser does on back/forward. If it is that big of an issue, you should find ways to code your app so that back/forward are handled at the page load.

Posted: Mon Nov 13, 2006 1:20 pm
by sahaja108
yes, maybe i need to intercept the event back/forward at client level and then send a msg to the server what is requested a back page...

i used a session array to keep track of the dynamic breadcrumbs. the difficult with this navigation is that there are many paths leading to a same page. so i couldn't rely on a hierarchy.
but, anyway, it was working ... until i clicked on the back button: this event creats paths with funny directions.

8)