I'm looking for a way to either disable the back button (hardware on Android, software on iPhone), or redirect the user to a different page (then the one that was previous).
My reasons for this aren't for nefarious purposes or anything. I'm working on a piece of exam software. A user answers all the questions in an exam/survey/quiz, submits the form, and is then taken to a page to see the feedback. At the moment, if they hit the hardware back button they get the alert box stating that the data has already been submitted, but they can still hit OK and be taken back to the exam and resubmit it, thus resubmitting either the same results or changing their answers and resubmitting.
I am looking for a way to disable this ability, either by disabling the back button somehow, or by redirecting the user to a new page.
A little bit of information regarding the app. The exam form is being submitted not using Ajax. The entire app is one URL, no matter what page you are on, the URL is always the same. By reloading that URL, you are taken to the login page (this is perfectly acceptable).
I've already looked into the HTML5 History capabilities, but because of it's lack of support in newer versions of Android, I can't use it. I need something that will work across Android, iPhone, and preferably Windows Phone 7.
There is no real way disable the hardware back button on the BlackBerry or Android.
What you can do is maintain a session variable which gets invalidated in your back handler and check for that session variable in the pagebeforeshow
event of the Exam page.