Skip to content Skip to sidebar Skip to footer

How To Set Timer In Html?

I want to show Loading(Gif) image for 3 seconds and want to open a website link(Say http://example.com), after the timer(3 Seconds) is complete. How to set timeout in HTML?

Solution 1:

You can use JavaScript for that: setTimeout

setTimeout(function(){ location.href = 'http://google.com'; }, 3000);

Solution 2:

You can use the html redirect

<metahttp-equiv="refresh"content="3; url=http://stackoverflow.com/" />

The number in content means seconds until the page is redirected to the next paramenter, url.

Solution 3:

You should be able to achieve this by using JavaScript's setTimeout

<script>window.setTimeout( function(){
        window.location = "http://www.example.com";
    }, 3000);
</script>

Post a Comment for "How To Set Timer In Html?"