0

I have one home page that has a hyper-link, on click of that it redirects to detail page. There I have one button in my jsp page. On click on that button, I am redirecting to another page which will process some functionality and will redirect on same page. So now I am back on same page. Now I have back button also on my page. So now I need to click twice to return on home page.

How I can ignore double click to return on home page.

HOME PAGE ---> Detail Page -- > Functional JSP page -- > Detail Page

Please suggest some solution.

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123

1 Answers1

0

It will be hard to meet this requirement, because to handle it server side, you will have to make a guess and force a redirect to home page when you are asked for detail page and when you are already there.

And I really say guess, because I cannot imagine how you could differentiate that from a full refresh (Ctrl-F5 on common browsers) ...

The alternative would be to use Javascript to try to intercept the usage of back button. But unfortunately you will have mainly the onbeforeunload event, and still no way I know to differentiate a back from a refresh.

But anyway, you do not want to do that. Your user clicked somewhere on first detail page and should know that something happened before he went back there (you could even have a message for that in the way of the flash from rails or Spring MVC). So he expects that the back button which brings him back one step will need 2 click to bring him back to home page.

The rule on UI is : even if you think that a different way would be nicer, always stick to common usage if you want your users to have a good experience with your application.

Serge Ballesta
  • 143,923
  • 11
  • 122
  • 252