As I am a beginner. I need help. I have seen some similar answers on this platform. However, I am not quite sure they solve my problem:
How can I refresh a page or make a particular set of code run at a particular time everyday?
Thank you
As I am a beginner. I need help. I have seen some similar answers on this platform. However, I am not quite sure they solve my problem:
How can I refresh a page or make a particular set of code run at a particular time everyday?
Thank you
You could try the method
setInterval(function() {
// Code you would like to run every 10 seconds (10000 milliseconds)
}, 10000)
or at a particular time (Credit Call a javascript function at a specific time of day)
var now = new Date();
var millisTill10 = new Date(now.getFullYear(), now.getMonth(),
now.getDate(), 10, 0, 0, 0) - now;
if (millisTill10 < 0) {
millisTill10 += 86400000; // it's after 10am, try 10am tomorrow.
}
setInterval(function() {
// Runs at 10am
}, millisTill10)