Auto call in 5 seconds

You can do the reloading of the page with Javascript in a simple way.

You can define an onload event that does the actions for the page’s self-call. When the page finishes loading the onload event is executed and then the page calls itself with a window.location . We will associate that window.location to a setTimeout() which is the Javascript function to execute actions with a delay indicated in milliseconds.

In the window.location attribute we have to assign the URL of the page that you want to be reloaded. So you’ll assign the filename of the page you’re building.

In the following code you can see an example of the solution that I propose to make the auto-invocation. The page I have created is called autocall.html, so in the window.location I assign the string autocall.html.

If your page is named something else, you’ll need to edit that filename. Another thing that you can set is the 5000 that is passed as a parameter in the setTimeout(), that indicates that you have to wait 5 seconds for the page to reload.

javascript autocall

See also  Mobile First
Loading Facebook Comments ...
Loading Disqus Comments ...