我有一個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