Refresh in Joomla
i have a Joomla site on a Apache/2.2.9 (Unix) mod_ssl/2.2.9 server and i would like it to refresh the page at 1 miniute past each hour to ensure the latest articles are shown, this is a radio website so listeners often have their browser open on the site for hours at a time. Can this snippet be adapted to refresh at 1 miniute past each hour?
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);
}
Thanks
You are already loading the pages in to a frame, no point in making this harder than it should be, just use a meta refresh set to 20 minutes or so.
i solved it in the end using this script, setting it to 1hr and uploading it 1 minute past... Simples
//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59 var limit="60:0"
if (document.images){ var parselimit=limit.split(":") parselimit=parselimit[0]*60+parselimit[1]*1 } function beginrefresh(){ if (!document.images) return if (parselimit==1) window.location.reload() else{ parselimit-=1 curmin=Math.floor(parselimit/60) cursec=parselimit%60 if (curmin!=0) curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!" else curtime=cursec+" seconds left until page refresh!" window.status=curtime setTimeout("beginrefresh()",1000) } }
window.onload=beginrefresh
精彩评论