A couple of questions:
I've never really used JS listeners other than onclick
and onkey
events, so I wondered if someone could help me with what I need in order to reload the page every X seconds?
Secondly, the page contains bare minimum, literally just one input box. Do I still need to include the html head
and body
?
setTimeout(function () { location. reload(1); }, 5000);
In JavaScript, you refresh the page using document. location. reload() . You can add the true keyword to force the reloaded page to come from the server (instead of cache).
You don't need Javascript for this simple function. Add in the page header:
<meta http-equiv="Refresh" content="300">
300 is the number of seconds in this example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With