With the following code, the timer countdown in negative -1, -2, -3, -4 etc. while fetching the new data / reloading the site.
Is it possible when it reaches 0 to have it show the string "Refreshing site.." instead of the negative countdown?
(function countdown(remaining) {
if(remaining <= 0)
location.reload(true);
document.getElementById('countdown').innerHTML = remaining;
setTimeout(function(){ countdown(remaining - 1); }, 1000);
})(5); // 5 seconds
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…