Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Hello guys, i need a countdown timer with start and stop button. and when i refresh it, it will not restart. it just continue until it reach zero. Please help me. how can i do this? pleas. thank you for answers
Posted

1 solution

You have several options. For example cookies can be used to store data between pages (or same page) even when refreshed. You only need to store the start time of the timer. You can calculate the time between from the current time minus the start time. So it will have the correct countdown value, even if a user browses to another site and comes back some time later.

For more info on persisting data in the browser, have a look here:
http://www.sitepoint.com/html5-browser-storage-past-present-future/[^]

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900