I want to load another HTML page after a specific amount of time

JavascriptHtmlTimer

Javascript Problem Overview


I have one html page "form1.html" which has an animated image. I want to load another page "form2.html" after 5 seconds. How do I do this?

Javascript Solutions


Solution 1 - Javascript

<script>
    setTimeout(function(){
        window.location.href = 'form2.html';
    }, 5000);
</script>

And for home page add only '/'

<script>
    setTimeout(function(){
        window.location.href = '/';
    }, 5000);
</script>

Solution 2 - Javascript

<meta http-equiv="refresh" content="5;URL='form2.html'">

Solution 3 - Javascript

use this JavaScript code:

<script>
    setTimeout(function(){
       window.location.href = 'form2.html';
    }, 5000);
</script>

Solution 4 - Javascript

Use Javascript's setTimeout:

<body onload="setTimeout(function(){window.location = 'form2.html';}, 5000)">

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionash9209View Question on Stackoverflow
Solution 1 - JavascriptWalialuView Answer on Stackoverflow
Solution 2 - JavascriptMajid FouladpourView Answer on Stackoverflow
Solution 3 - JavascriptmehdiView Answer on Stackoverflow
Solution 4 - JavascriptFleming SloneView Answer on Stackoverflow