wood burning stoves 2.0*
The moose likes Servlets and the fly likes disable the back button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "disable the back button" Watch "disable the back button" New topic
Author

disable the back button

sushant prabhu
Ranch Hand

Joined: Mar 22, 2001
Posts: 66
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


Sushant Prabhu<br />SCJP2<br />SCWCD<br />OCA9i
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
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

Joined: Nov 07, 2000
Posts: 621
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

Joined: Dec 01, 2000
Posts: 118
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


<B>Bhupendra Mahajan</B>
octavyn pittman
Ranch Hand

Joined: Mar 06, 2001
Posts: 134
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

Joined: Dec 01, 2000
Posts: 118
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

Joined: Jan 31, 2000
Posts: 1467
Yes. We can make it harder for the user to go back but not impossible.
regds
maha anna
 
 
subject: disable the back button