Skip to content

Instantly share code, notes, and snippets.

@Rizwan-Hasan
Last active May 28, 2020 22:12
Show Gist options
  • Save Rizwan-Hasan/93dfed2f1487a351378d6ed294a61cd7 to your computer and use it in GitHub Desktop.
Save Rizwan-Hasan/93dfed2f1487a351378d6ed294a61cd7 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1 align="center">Redirecting in <span id="countdown">10</span> seconds</h1>
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
var webLink = "https://google.com";
function countdown() {
seconds = seconds - 1;
if (seconds < 0) {
// Chnage your redirection link here
window.location = webLink;
} else {
// Update remaining seconds
document.getElementById("countdown").innerHTML = seconds;
// Count down using javascript
window.setTimeout("countdown()", 1000);
}
}
// Run countdown function
countdown();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment