我有一个Apache/2.2.9(Unix)mod_ssl/2.2.9服务器上的Joomla网站,我希望它在每小时过去1次刷新页面以确保显示最新文章,这是一个广播网站,因此听众经常会在网站上打开浏览器几个小时。 这个片段是否可以适应每小时过滤1次?刷新Joomla
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);
}
感谢
我想如果你刷新无线电将停止播放,你会惹恼你的访客。最好每20分钟做一次服务器的Ajax调用,以检查是否有新的内容出现... – silvo 2010-10-10 16:04:47
Hi silvo,媒体播放器加载到一个单独的栏,这应该不成问题,但我会研究阿贾克斯的事情,看看我能否得到这个工作。 – 2010-10-11 10:03:47
如果有人想要查看我的意思,请访问www.stompradio.com感谢 – 2010-10-11 10:04:42