hi, i have some issue with this js code, all what i need freeze the time when the users left the webpage when the countdown circle is run.
You have to save the time they left the page. You can do that using localStorage. So you store that time as a string under a key. When a user hits the page, check to see if there is something with that key stored, if there is, figure out the start time using that, otherwise start from zero.
i’ll see if is there no solution i’ll start from zero
That is the solution, what I described: when the window closes (the “unload” event), store a timestamp. When the window opens, check storage. If there is a time saved, get the time now and compare it to the saved time. From that, you know how many seconds have elapsed. If that’s less than how long your timer runs for, then restart the timer at that number of seconds.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.