Reputation: 5228
i was wondering if there is any solution for implementing a javascript counter that doesn't reset at page refreshm but it continues counting until the set time passes.
What do you know about it?
thank you
Upvotes: 2
Views: 3438
Reputation: 3999
You can use localStorage or cookies to store your current counter value. Here's an example: http://jsfiddle.net/ArtBIT/KsYE4/
Upvotes: 2
Reputation: 490657
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.
Upvotes: 2
Reputation: 53929
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.
Upvotes: 3