In this tutorial we are going to discuss Reload Page after Specific Time
The JavaScript setTimeout() function sets a timer to run a function or definite code after a preselected time. If you want to refresh the page automatically after given time, the setTimeout() function is helpful to do it in JavaScript. The location.Reload () function helps to reload the present URL and refresh web page. Use location.Reload () function in setTimeout () to reload the page after given seconds using JavaScript.
The following javascript code snippet reloads page after 10 seconds and the web page will refresh automatically after q0 seconds in JavaScript code.
The delaying time must be defined in milliseconds. If you want to run code after 10 seconds, 10000 should be pass in the delay parameter.
setTimeout(function(){
window.location.reload();
}, 5000);
This javascript code example sets 10 seconds to reload the page, you can set the time as per your requirment.
0 Comments