I am doing an online quiz application in PHP. I want to restrict the user from going back in an exam.
I have tried the following script, but it stops my timer.
Just set location.hash="Something". On pressing the back button, the hash will get removed from the URL, but the page won't go back.
location.hash="Something"
This method is good for preventing going back accidentally, but for security purposes you should design your backend for preventing reanswering.