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?

3
  • Why marked duplicate of a jQuery question while the question title is out of jQuery topics?! Commented Mar 16, 2016 at 7:00
  • look at stackoverflow.com/questions/503093/… Commented Apr 20, 2016 at 20:30
  • 1
    ^ Clever way of making your third-page question look like the accepted answer, which has 8800 upvotes. Commented Jun 13, 2016 at 18:10

4 Answers 4

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>
Sign up to request clarification or add additional context in comments.

Comments

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

Comments

17

use this JavaScript code:

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

Comments

1

Use Javascript's setTimeout:

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

1 Comment

Please do avoid long inline javascript

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.