1,364 views +0 -0

Website redirect with timer


<!DOCTYPE html>
<html>
<head>
	<title>
		website.tld
	</title>
	<meta http-equiv = "refresh" content = "5; url = https://website.tld" />
	<style>	</style>
<script>
function startTimer(duration, display) {
    var timer = duration, seconds;
    setInterval(function () {
       seconds = parseInt(timer % 60, 10);

        display.textContent = seconds;

        if (--timer < 0) {
            timer = duration;
        }
    }, 1000);
}

window.onload = function () {
    var fiveMinutes = 1 * 5,
        display = document.querySelector('#time');
    startTimer(fiveMinutes, display);
};
</script>
</head>
<body><center><p>U wordt over <span id="time"></span> seconden doorgestuurd naar website.tld</p></center></body>
</html>