Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

disable the back button

 
sushant prabhu
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i hav developed a banking application using servlets - jdbc.
when the account holder enters the servlet he gives his
acc no and password on the basis of which he performs his deposit and withdrawal operations.
i dont want subsequent users or the same user from the same browser to see the transactions he has done.
how do igo about it
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way of doing it except make the browser not to make a cache of your page. Please make a search in this forum. This question came up many times before.

regds
maha anna
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set the header from the servlet before you write out anything to the client to effectivly remove any cached pages.
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Expires", "Thu, 01 Dec 1994 16:00:00 GMT");
This will not allow the use of the browser's back button (actually, you can use the back button all you want but you'll have to refresh to see any content).
Sean
 
Mahajan Bhupendra
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
my friend anand has done a little trick and it works..
just add javascript lines to your code.

<script language="Javascript">
javascript:window.history.forward(1);
</script>
it's nothing but if user click on back button he will be
forwarded to the current page only..
Bhupendra
 
octavyn pittman
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bhupender,
Wouldn't this little trick just solve the above problem for only one click, but a user could then look at the back button's history list or even just click back twice and get around the trick?
OP
 
Mahajan Bhupendra
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes of course
it will work for only one back..
something is better than nothing
don't u think so???
Bhupendra
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. We can make it harder for the user to go back but not impossible.
regds
maha anna
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic