68

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,018
  • 2
  • 9
  • 16

4 Answers4

62
<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,096
  • 2
  • 27
  • 29
20
<meta http-equiv="refresh" content="5;URL='form2.html'">
Kyll
  • 7,036
  • 7
  • 41
  • 64
Majid Fouladpour
  • 29,356
  • 21
  • 76
  • 127
17

use this JavaScript code:

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

Use Javascript's setTimeout:

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