I am creating a quiz web app, during game play I want to prevent the user from refreshing the page so the timer doesn't restart.
My app auto-save score when the game is finished (when all questions answered or time is out), but the problem is when I refresh the page (before time is out) it is still working (the timer reboot, so the player can cheat and have extra time to think and answer, or even check correct answers)
I tried to prevent refreshing events, I could deactivate F5 and reload button but hitting enter on the address bar is still working.. I realized that it is not possible to prevent all refreshing events, so I tried to think different:
- When the player click refresh, I want him to be redirected to main menu.
- The category played will be automatically deactivated (so refreshing will be considered as cheating)
Any JS script can help me doing that?
If you have any other suggestion for such type of app that will be good as well.