Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A pure JS redirect with configurable URL and delay.
<script type="text/javascript">
// delay, in milliseconds
var delay = 6000;
var URL = "https://example.com";
document.write("<h1>This page has moved. You will be redirected in " + delay/1000 + " seconds. If you are not redirected, please <a href=" + URL + ">follow this link</a>.</h1>");
setTimeout(function(){ window.location = URL; }, delay);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment