-3

I made a countdown timer, how do I connect to the website after the time runs out? I'm using CodeIgniter framework

this my script for countdown timer

<script>
var target_date = new Date('Sep, 18, 2015 15:02:00 GMT-0700').getTime();

var days, hours, minutes, seconds;

var countdown = document.getElementById('countdown');

setInterval(function () {

    var current_date = new Date().getTime();
    var seconds_left = (target_date - current_date) / 1000;

    days = parseInt(seconds_left / 86400);
    seconds_left = seconds_left % 86400;

    hours = parseInt(seconds_left / 3600);
    seconds_left = seconds_left % 3600;

    minutes = parseInt(seconds_left / 60);
    seconds = parseInt(seconds_left % 60);

    countdown.innerHTML = '<div id="days" class="timer_box"><h1>' + days +  '</h1> <p>Days</p></div> <div id="days" class="timer_box"><h1>' + hours + '</h1> <p>Hours</p></div> <div id="days" class="timer_box"><h1>'
    + minutes + '</h1> <p>Minutes</p></div> <div id="days" class="timer_box"><h1>' + seconds + '</h1> <p>Seconds</p></div>';  

}, 1000);
</script>
irwan Dwiyanto
  • 321
  • 3
  • 7
  • 19

1 Answers1

0

If I understand your Question correctly, what you are looking for is a redirect to the website you want the user to visit.

There are plenty of tutorials on how to do it, for example

https://stackoverflow.com/a/506004/1080604

The Solution is, to check if the Time remaining is smaller than one Interval-Time, and then call a window.location.replace.

Community
  • 1
  • 1
EGOrecords
  • 1,959
  • 2
  • 19
  • 33