Auto refresh page using javascript

By
Advertisement

Introduction:
In my previous article I have explained about  how to auto redirect page using javascript. In this article I am going to explain about how to auto refresh the page after some time delay using javascript.

Explanation:
To auto refresh the page after 5 seconds the below  javascript code is used.

<form id="form1" runat="server">
<div>
    <script type="text/JavaScript">

        function timedRefresh(timeoutPeriod) {
            setTimeout("location.reload(true);", timeoutPeriod);
        }

    </script>
    <p>
        <a href="javascript:timedRefresh(3000)">Refresh this page in 3 seconds...</a></p>
</div>
</form>

In the above code instead of calling the tiledRefresh function in onclick event if you call it in window.onload then the page will get refreshed automatically after 3 seconds..

Do you like this article. Help us to improve.Post your comments below.

1 comment:

Online Casino