Redirect Page
Please wait for 120 seconds…
';
clearInterval(countdownInterval);
countdownButton.disabled = false; // Enable the button after redirection
} else {
countdownElement.innerHTML = 'Please wait for ' + countdownDuration + ' seconds...';
countdownDuration--;
}
}
function startCountdown() {
var countdownButton = document.getElementById('countdownButton');
// Disable the button during the countdown
countdownButton.disabled = true;
// Reset duration and update UI
countdownDuration = 120;
document.getElementById('countdown').style.display = 'block'; // Show the countdown message
updateCountdown();
// Start the countdown interval
countdownInterval = setInterval(updateCountdown, 1000);
// Add event listener for visibility change
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === 'visible') {
// Reset the countdown when the page becomes visible again
clearInterval(countdownInterval);
startCountdown();
}
});
}