.
<script src="https://welpike.github.io/url/api/redirect.js"></script>
let url = "https://welpike.github.io/url/docs.html"; // define the url
delay = 5; // define the time before the redirecting (in seconds)
redirect(url, delay); // call function
It's finish.
Test the script : test >>
Source code of the test page : https://github.com/Welpike/url/blob/master/docs-test.html
redirect.js uses window.location.replace()
.
<p style="font-family:monospace;">Redirect powered by <a href="https://welpike.github.io/" target="_blank">welpike.github.io</a></p>
For the back-end developers using frameworks (like django), a new update plans that the redirect.js script recovers the domain name.
Instead of code this let url = "http://127.0.0.1:8000/{% url 'login' %}";
(e.g.), you can write this : let url = domain + "{% url 'login' %}";
.
Welpike