Just notice that Safari 10.0.3 delay my code when the page is in a background tab.
var interval = 2000;
var scriptTime = new Date().getTime();
function addTime(){
scriptTime += interval;
document.getElementById('output').innerHTML = "Current state: scripts delayed by "+(new Date().getTime()-scriptTime)+"ms";
}
setInterval(addTime, interval);
Try here: https://jsfiddle.net/rhrrsgrf/4/
Found some confirmation of optimization with small interval, but nothing about timer bigger than 1 second (still hope that's only a bug...). Chrome 56 seems to have something similiar (https://www.ghacks.net/2017/01/25/chrome-to-throttle-expensive-background-timers/), but isn't impacting my code.
Any other simple solution to send a ping (30 sec) to a server?