/    Sign up×
Community /Pin to ProfileBookmark

24hours countdown with javascript

please everyone
i need a javascript 24hours countdown that doesnt restarts on reloading the page and also loads a page when the countdown is done

ive tried a lotta things
i am mainly having issues with the countdown restarting once the page is reloaded

please someone help

to post a comment
HTMLJavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 29.2022 — I would think you'd want to save a cookie with the target time (or the start time?), then use that to calculate where you are in the countdown after a refresh (if you haven't yet already reached the target time).
Copy linkTweet thisAlerts:
@SempervivumJun 29.2022 — @NogDog#1645062

Yes, a cookie would be fine, however, IMO local storage is easier to handle, therefore I would prefer it:

https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
×

Success!

Help @AnonJah spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...