is there any options (PHP, JavaScript) how to refresh website exactly every 10th minute?
I got some crob job on server, and every 10th minute I’m reloading the online RTSP stream downloading, and after this reload the video on site get stuck, so I need reload the page every 10th minute after the cron job executed.
Thanks for hints.
Advertisement
Answer
Since you are waiting for an external event to occur (cronjob) then you might consider doing
in the crojob write to a file to indicate that the job is complete
in your html page use JavaScript setInterval() to make an AJAX call to see if the file exists
the AJAX call should ‘look’ for the file. If it doesn’t exist then return false other wise delete the file and return true
The JavaScript should act accordingly to the returned value.
Note: the setInterval() timing can not be relied upon as JavaScript takes a backseat to other events that are occurring on the page. Best set it to every 2 or 5 minutes.