1

Our application forbids going back for several reasons. Basically because that's just how our application works (JSF with facelets as GUI) You always have to enter on the welcome site, once you chose an application-flow you can only leave / abort when you tell the application (e.g. press a button). If you just browse away e.g. enter "example.com" in the address bar the state of your flow gets saved and once you relogin, you can resume the work. Going back is only possible when it was specifically designed like this with a 'back' submit - button. Of course users keep pressing the 'back' button (i would do so as well) and they keep getting 'error: session out of synch'. This is a learning process and a couple years ago we just disabled the back-button to make things clear. Sadly this is no longer supported. So instead of teaching the user the hard way and forcing him to relogin, are there some good alternatives I'm missing?

i found this link which should offer 3 methods to disable the back button - but in reality it just further confirms the fact that it is impossible to do it in a semi-nice way.

Toskan
  • 13,911
  • 14
  • 95
  • 185
  • 1
    possible duplicate of [Disabling Back button on the browser](http://stackoverflow.com/questions/87422/disabling-back-button-on-the-browser) – AJ. May 10 '11 at 17:28
  • thanks for pointing this out (for other visitors). Of course I read that post but what people state there is the best practice 'don't break the back button'. I have to break it - what are my best options to keep a good user experience? – Toskan May 11 '11 at 09:18

2 Answers2

2

when the user tries to go to a previous page you can redirect him to the page he should be at in other words catch the "out of sync" and redirect him

ratchet freak
  • 47,288
  • 5
  • 68
  • 106
  • the problem is with redirecting. Redirects are not allowed in our application e.g. you cannot just jump from google to page C, once browsed away you always per se have to start with page A. (we store a request scoped sequential number). We could though, achieve this behaviour by catching an illegal request and redirecting to the correct page (and adding a new request number as well). Just seems a bit dangerous. – Toskan May 13 '11 at 08:43
  • then when you see someone going to page C when he shouldn't (from external links or back button) redirect him to page A – ratchet freak May 14 '11 at 10:26
  • just doesn't seem to teach the user better than an error message stating back is disabled... you click back and end on the same page you were just before. – Toskan Jun 10 '11 at 11:57
1

You might find a workable solution here How do I insert an entry into browsing history via JavaScript by inserting an extra step into the browser's history (perhaps a link to the current page with query string parameters that result in a nice big red box message to the user), or you could try attaching an event handler to the OnBeforeUnload event so the user gets a confirmation dialog when trying to leave the page (you'd want to remove the handler when the submit button was clicked).

Community
  • 1
  • 1
tomfumb
  • 3,669
  • 3
  • 34
  • 50
  • actually I don't think changes in the browser history would (should?!?) work, just imagine someone adding a million entries to your history when you enter a site. – Toskan May 11 '11 at 09:36