Reputation: 1
I have this code :
<h1 id="countdown-holder"></h1>
<script>
var clock = document.getElementById("countdown-holder")
, targetDate = new Date(2050, 00, 01); // Jan 1, 2050;
clock.innerHTML = countdown(targetDate).toString();
setInterval(function(){
clock.innerHTML = countdown(targetDate).toString();
}, 1000);
</script>
How can i load page after countdown finish ??
Upvotes: 0
Views: 283
Reputation: 6873
This is exact what you need
var now = Date.now();
if (now >= targetDate) {
window.location = './target/url';
}
Upvotes: 1
Reputation: 1294
Since you have not described your "countdown" function here, we can assume that you can match when the countdown finish. Use the following code when your countdown finish:
window.location.replace("Page URL");
Upvotes: 0