how to stop restarting the timer on page reload in rails?

I used a jquery count down plugin to display the time left. While taking the exam when the user reloads the page then the timer is getting restated.

How can I stop restarting this timer upon page reload?

Here I want the timer should show the time left even upon page reload, or even the browser window closed and reopened back. When I search for this I got the results saying that it can be implemented using cookies, but I have no idea of cookies.

how to implement this with cookies in jquery?

here is the link to timer plugin.

Answers 1

  • When user starts the exam, save that time somewhere in the database against the user, when user reloads at some point of time during the exam, get the duration by subtracting current time from the time he had started the exam and use that value in Javascript.

    Hope that helps!


Related Articles