我在 Apache/2.2.9 (Unix) mod_ssl/2.2.9 服务器上有一个 Joomla 站点,我希望它在每小时 1 分钟后刷新页面,以确保显示最新文章,这是一个广播网站,所以听众经常在网站上打开浏览器几个小时。这个片段可以适应每小时 1 分钟刷新吗?
function refreshAt(hours, minutes, seconds) {
var now = new Date();
var then = new Date();
if(now.getHours() > hours ||
(now.getHours() == hours && now.getMinutes() > minutes) ||
now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
then.setDate(now.getDate() + 1);
}
then.setHours(hours);
then.setMinutes(minutes);
then.setSeconds(seconds);
var timeout = (then.getTime() - now.getTime());
setTimeout(function() { window.location.reload(true); }, timeout);
}
谢谢