how to make countdown timer to not reset on page refresh

前端 未结 4 995
无人及你
无人及你 2021-01-27 17:18

I am creating an online exam page for my project. I have a countdown timer, but it resets on page refresh. How can I make it not to reset? The timer is set by fetching time from

4条回答
  •  耶瑟儿~
    2021-01-27 17:59

    When the user starts the exam, save the start time in the database. Use that for everything. Don't rely on client side code for this as the user can easily modify it.

    If you save the start time, you know when the user started and what the current time is. You can use that to see if time is up or not. A javascript timer is good to show how much time is remaining, but it should be getting that info from the database.

提交回复
热议问题