-3

Hi I have a requirement in my application to redirect to specified page whenever browser back button is clicked.I have searched in many forms but unable to attain what exactly I need. Can anyone provide me the best solution which fixes the issue .....

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • Why is this tagged Java? Java != Javascript. – John Dvorak Oct 06 '13 at 08:01
  • Thanks guys for ur replies, is there any alternate solution or ideal methodology to disable back button ? – user2851252 Oct 06 '13 at 08:20
  • @user2851252:- Not very clear thought what you want to achieve. I have voted to close the question. Check if this is helpful for you:- http://viralpatel.net/blogs/disable-back-button-browser-javascript/ ? – Rahul Tripathi Oct 06 '13 at 08:25
  • you can cripple the back button, and many have done so accidentally, by performing a javascript "redirect" from the homepage. Don't do that! Rather, tell us what you _really_ want to achieve and why. – John Dvorak Oct 06 '13 at 09:49
  • As mentioned earlier I am working for financial project where security is the major concern.The scenario is -whenever the user clicks the browser back button and refreshes the page double posting issue is been encountered for which duplicate transactions are been inserted in the database and it is showing unexpected results.Please provide the solution for above scenario. – user2851252 Oct 06 '13 at 11:07

1 Answers1

0

You need to follow the Post-Redirect-Get(PRG).

Your scenario :- you are navigating from page 1 ---> page 2 ---> page 3. Click Back on page 3. So requires will be fired whatever request was fired while navigating from page 1 to page 2.

Solution:- Follow PRG while navigating from page 1 to page 2.

M Sach
  • 33,416
  • 76
  • 221
  • 314