• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to disable back button in the browser?

I would like to disable the back button in broser after saving data into database. then I didn=t want the user can go back using browser previous page button.

How to do this?

I need something like session has expired message or redirect, but i am not sure how to do it?

There is no 100% secure and effective way you can do this, and you will be relying on Javascript for this functionality. If a user disables JS then your solution wont work. However, if you are okay with this, just google "disable browser back button in javascript" for about 500,000 results!

You can't disable the button in a safe way, as @boltsabre already stated.

But, you may either use session data and set a session flag once the form is submitted. For this flag you'll check on the form page before displaying the latter. If the flag exists, the user has most likely pushed the back button.
You may additionally set the TTL of your form page to 0 seconds i.e. it is expired after propagation to the browser so each time the user hits the back button the page needs to be newly loaded and not loaded from the browser's cache.

There are a few techniques here that might help you with this http://stackoverflow.com/questions/96118...ack-button

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.