This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Prevent Back Page  RSS feed

 
Praveen Banthia
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a very common problem the user is hitting submit score and score is displayed on a new screen . Now user go backs and hits enter again then the score is getting doubled ie(the score is calculated again) how can I write code on server side such that if user presses back button on browser he redirected to welcome page and not the previous page which has the game or( redirect him to the same page)
need solution for both types as I have not decided how will I implement it.
Please no advice on disabling browser back on web browser not an acceptable solution as it can be subverted very easily.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen Banthia wrote: how can I write code on server side such that if user presses back button on browser he redirected to welcome page and not the previous page

You cannot write any server side code for the browser back button. The back button is a browser event and no request is made to the server unless there is a reason to make one.
You can use Javascript for the browser. For the page in question, you can ask the browser not to cache it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!