I have a webpage which is basically a countdown timer. The initial value of the timer is received from server. What I want to do is to save the remaining value of the timer when the page is closed or refreshed. Are there any way to do this without syncing the value of the timer periodically?
Share
Try
window.onbeforeunload. It is called before the browser changes the page (either by closing or navigating away), and you could use it to send the data back, something like: