Skip to content

Instantly share code, notes, and snippets.

@jamesnotjim
Created September 6, 2017 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesnotjim/d0f3f772631970d6fac848daa0936b1a to your computer and use it in GitHub Desktop.
Save jamesnotjim/d0f3f772631970d6fac848daa0936b1a to your computer and use it in GitHub Desktop.
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