Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q707 How can I refresh a webpage every 30 mins on the hour and the half-hour?

irt.org | Knowledge Base | JavaScript | Redirect | Q707 [ previous next ]

Q707 How can I refresh a webpage every 30 mins on the hour and the half-hour?

It would be easier if it were just every 30 minutes -- you could then just use a META tag to refresh the location. But to refresh on the hour and at half past the hour, you will need JavaScript:

<SCRIPT LANGUAGE="JavaScript"><!--
function startTimer() {
    var now = new Date();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
    setTimeout('refresh()',(((30 - (minutes % 30) - ((seconds>0)?1:0)) * 60) + (60 - seconds)) * 1000);
}

function refresh() {
    window.location.href = 'http://www.irt.org/';
}

startTimer();
//--></SCRIPT>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.