Page 1 of 1

Dectecting browser back button press

Posted: Sun Nov 18, 2007 8:35 pm
by rohant18
Hello All,
I have a web application system developed in PHP. there is a databese record locking functionality implemented in this system.
I have a requirement that needs to decect the browser back button press and take a action on it.i.e unlocking of record when a back button
is pressed by the user instead of standard back button provided on web page by the system.

how can i capture the action of pressing of back button in php?

your help would be highly helpful.

thanks in advance,
-Rohant

Posted: Sun Nov 18, 2007 9:05 pm
by Kieran Huggins
The short answer is: no.

The long answer is: extremely complicated.

The real answer is: you have a design problem.

Posted: Mon Nov 19, 2007 12:13 am
by rohant18
Yes the actual problem is in design,
but use of back button was not expected when the initial design was developed.
when the users started using the system,disabling of back button did not prove to be that much user friendly.
So there was a request for enabling the back button functionality.thats why the need arose

could you please elaborate on the second answer of yours? i.e the complex solution :D

-Rohant

Posted: Mon Nov 19, 2007 4:12 am
by Kieran Huggins
You'll need to avoid all browser caching, and you'll probably have to set a step-counter or something similar in the URL to detect that you've gone "backwards" in the app.

It feels really hackish, and for the sake of future troubleshooting (and your general sanity) you'll probably want to just alter the workflow to accommodate this beahviour.