View Full Version : prompt before allowing back button
08-14-2005, 12:44 AM
I need to find a way, so that if the user clicks the back button on the browser, i can prompt them, and potentialy disallow the use of the back button.
*Click back button*
Are you sure you want to go back? Data will be lost!
The page dosnt change.
If anyone knows how i can do this, plz inform.
08-15-2005, 04:04 PM
Cannot be done reliably.
You can put code in the onunload of the page to TRY, but it doesn't always fire.
You can try to remove the back button, but I have keyboard shortcuts to go back and my right-click menu.
You can try to take that away, but I have a quick bookmarklet to get it back b/c it really irritates me when people do that.
So, you can try to save the user from himself/herself, but your best bet is to inform them in plain text at the top of the page...
IF YOU LEAVE THIS PAGE WITHOUT SAVING (INCLUDING HITTING BACK BUTTON) YOUR DATA WILL BE LOST.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.