I want to load another HTML page after a specific

2019-02-03 21:35发布

问题:

This question already has an answer here:

  • How do I redirect to another webpage? 58 answers

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?

回答1:

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

And for home page add only '/'

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


回答2:

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


回答3:

use this JavaScript code:

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


回答4:

Use Javascript's setTimeout:

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