Dectecting browser back button press

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rohant18
Forum Newbie
Posts: 2
Joined: Sun Nov 18, 2007 8:20 pm

Dectecting browser back button press

Post 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
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

The short answer is: no.

The long answer is: extremely complicated.

The real answer is: you have a design problem.
rohant18
Forum Newbie
Posts: 2
Joined: Sun Nov 18, 2007 8:20 pm

Post 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
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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.
Post Reply