A (javascript) countdown that doesn't restart at page refresh?

You could store the current countdown timer count in a cookie (you would do that every time the timer changes). And then when the page loads (or refreshes) check for the value of that cookie first, and if it is set use that value as the starting point of the countdown counter.

You will need to store its state somewhere, either in a cookie or serverside. On each page load, the code will need to check its state and adjust its countdown accordingly.

You can use localStorage or cookies to store your current counter value. Here's an example: jsfiddle.net/ArtBIT/KsYE4.

In this example, you are storing the counter, you should be storing the target data. Right now, when you refresh the page, it goes to what it was before the page was reloaded, even if it took 20 seconds to reload. That is, if the counter was at 30, and it takes 10 seconds to refresh, is should then be at 20 – Juan Mendes Sep 13 at 19:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions