Back Forum Reply New

How to prevent users from clicking the back button

I use Spring and well as Hibernate and Struts. The back button can be a real pain for web developers, and I am in this situation. I have seen websites that prevent the back button from being used. How can I do the same with Spring (or struts).

Any insight to this problem would be most appreciated.

Thank you.

Its not a Spring or Struts issue.

You basically need to:

1. Embed something unique in a page so that you can sync up with its state held on the server. This is what webflow does at a high level, OR

2. Store state in the webpage so that it doesn't matter if the user hits back.

Disabling the back button is not really the right thing to do for my 2c, I think you have to expect the user to hit Back and deal with it.

Unless you cannot use javascript, this should help.  I use it just in case someone registers at the site, and they hit the back button.

I think that Webflow would help too.

Code:
lt;script type=quot;text/javascriptquot;gt;   lt;!--       history.forward();   //--gt;
lt;/scriptgt;
Good luck,

Steve O

I think a lot of it depends on WHY you don't want users to click the back button.  If you had time (and motivation) to share your specifics, I'd be interested.

Even the simplest scenario may require a lot of work to overcome, but I still wouldn't try to do this for all the reasons mentioned.  I would try to build your app in a manner that can deal with a user clicking back as gmatthews has suggested.

When you're allowed to use javascript there are other ways to help the user avoid the back button, but in my opinion they all fall under the categories of unreliable or annoying and might also involve refactoring a lot of code.
¥
Back Forum Reply New