On Mon, 2007-08-06 at 15:15 +0100, Escalada Sergio wrote: > Hello. > I am using MyFaces 1.1.5, Tomahawk 1.1.6 in my WEB Aplication, and i > have a requirement mandatory to disable the browser back button while > the user is interacting with the aplication. The requirement is really > serious and compromise the usability of the aplication, can anyone tell > me if it is possible to do anything to avoid the use of the browser back > button?, or at least to control the use of it trying to avoid the > consecuences it carry. > > Thanks in advance, sorry for my english.
There's no easy solution to this one AFAIK. A website (ie html, javascript, etc) is forbidden from modifying browser menus, etc for security reasons. The chaos that an evil website could create if this was permitted would be huge. The options are: (1) when a user clicks "back", your webapp does the right thing. This is surprisingly difficult to achieve, however. For a start you should avoid all session-scoped beans. (2) when a user clicks "back", you show a page saying "don't do that". (3) launch your webapp in a popup window. The popup window can be created without a menubar. Note that a user can still use shortcut keys to trigger "back", but that takes far more effort. (4) use an active-x control (for IE) or similar for firefox etc. to disable the back button. I don't know if this is actually feasable, and the user will certainly have to "authorise" the control to run. It's also browser-specific, ie you'll need to implement the equivalent for every browser type you support. The "auto-forward" solution proposed elsewhere in this thread is interesting. I suspect it has interesting side-effects though. You'll need to think through carefully whether this will work for your site. I don't know of any other solution. The problem is the fundamental web concept that a browser should never trust a website - and allowing a website to disable core browser functionality (back button in this case) certainly takes trust. I've always used option (3) in the end. It's not terribly pretty but it works. Regards, Simon

