harsher
harsher

Reputation: 57

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?

enter image description here

Upvotes: 0

Views: 2273

Answers (3)

driconmax
driconmax

Reputation: 942

You can use the html redirect

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

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

Upvotes: 1

Andy Holmes
Andy Holmes

Reputation: 8087

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

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

Upvotes: 1

ghostprgmr
ghostprgmr

Reputation: 488

You can use JavaScript for that: setTimeout

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

Upvotes: 2

Related Questions