[Ilugc] Disabling the refresh and back button in browser

  • From: rajanvn@xxxxxxxxx (Natarajan V)
  • Date: Wed Jun 2 12:23:25 2010

On Wed, Jun 2, 2010 at 11:25 AM, Raju s <rajusns@xxxxxxxxx> wrote:

I have done an online examination application in jsp.
I want to disable the back and refresh button.
When googled there are many scripts and none of them are working in all the
browsers.

Good that you did your homework :-)

The advice from the experts is that you should not do the disable.

Very true.

My problem is when the user clicks refresh or alt+ or back the time gets
reset to the beginning.

What you can do is open up a new window without the toolbar. This way,
the most obvious way of clicking the refresh button or the backbutton
will be out of reach.

The user can still do a Ctl+R, F5 or Alt+Left key strokes. You will
not be able to control it, and even if you do control it, it will not
be foolproof. there will always be a way to circumvent it.

The first step in achiving this is put up a huge banner which says
that the test will become invalid if the user tries to refresh or go
to previous page. Then, hold a random number in the "user session" as
well as in a  hidden field. keep checking this variable and make sure
that it is the latest. If the user tries to do a back button or
refresh, the numbers won't match and you can tell him that he has just
did the wrong thing and failed the exam :(. Or, if you have coded it
smartly, you can go back to the previous question.

Hth,
Natarajan

Other related posts: