69

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?

ash9209
  • 1,028
  • 2
  • 9
  • 15

4 Answers4

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

And for home page add only '/'

<script>
    setTimeout(function(){
        window.location.href = '/';
    }, 5000);
</script>
Walialu
  • 4,018
  • 2
  • 26
  • 29
20
<meta http-equiv="refresh" content="5;URL='form2.html'">
Kyll
  • 6,999
  • 7
  • 40
  • 61
Majid Fouladpour
  • 27,709
  • 19
  • 72
  • 126
17

use this JavaScript code:

<script>
    setTimeout(function(){
       window.location.href = 'form2.html';
    }, 5000);
</script>
mehdi
  • 1,745
  • 2
  • 15
  • 21
1

Use Javascript's setTimeout:

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