Alert User Before Abandoning Lesson on Back Button

If you are progressing through a lesson answering questions and you (stupidly) as I did press the back button thinking it would let me go back to the previous question, instead you are thrown out of the lesson and back to the previous page you were in.

I don’t think it’s really necessary to add a way to back up, but I do think that when a lesson is in progress and the user presses back, it would be nice to get confirmation from them that they will be abandoning the lesson. I think you might be able to do this with a beforeunload event handler, but I’m not sure how tightly bound the web site and app are and whether this would make things worse on the site.

1 Like

Good catch. Actually there was onbeforeunload in the code that should handled such cases (it was checking for progress of a quiz or flash card session and noticing users if they try to leave the page). But seems something has change (not sure if it was a browser related or some third party code) and this didn’t got triggered. Luckily when I switch the event to just beforeunload it all worked as before.
The only sad thing is that we can’t control the message from the warning. It is all related to the browsers and their defaults that can’t be changed (even I’m not sure if this will work on safari, as safari have put quite a restrictions on those events “for security reasons”), but I think that the current solution will work (tested on Chrome and Firefox and worked well).
Ah, one more thing, in the app it is not working at all, as it is some sort of app wrapper that we don’t have much access to is code and capabilities.