Created
June 8, 2022 02:58
-
-
Save carlos-jenkins/215bd192a390861ddce602859461df39 to your computer and use it in GitHub Desktop.
Simple redirect page for domain change with manual link and countdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>This domain is gone. Redirecting...</title> | |
| <style> | |
| body { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| font-size: 2em; | |
| text-align: center; | |
| font-family: arial; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="content"> | |
| <p>The content you're looking for was migrated to a new domain:</p> | |
| <p> | |
| <a id="link"></a> | |
| </p> | |
| <p>You will be redirected in <span id="seconds"></span> seconds ...</p> | |
| </div> | |
| <script> | |
| const newDomain = "https://my.new.domain.com" | |
| const waitTimeMs = 10000 | |
| const locationTarget = ( | |
| newDomain + | |
| window.location.pathname + | |
| window.location.search | |
| ) | |
| let timeLeft = waitTimeMs / 1000 | |
| // Update UI | |
| document.getElementById("link").innerHTML = locationTarget; | |
| document.getElementById("link").href = locationTarget; | |
| document.getElementById("seconds").innerHTML = timeLeft; | |
| // Countdown | |
| setInterval(function() { | |
| timeLeft -= 1 | |
| if (timeLeft > 0) { | |
| document.getElementById("seconds").innerHTML = timeLeft; | |
| } | |
| }, 1000) | |
| // Timed redirect | |
| setTimeout(function() { | |
| window.location.href = locationTarget | |
| }, waitTimeMs) | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment