You are here: irt.org | FAQ | JavaScript | Redirect | Q306 [ previous next ]
<script language="JavaScript"><!-- if (document.images) location.reload(true); // forces a reload from the server else location.href = location.href; // just reloads the page //--></script>
Although this will continually reload the page if it is less as shown. What is needed, is a test to see if the page has already been reloaded (perhaps in the last second):
<script language="JavaScript"><!-- function forceReload() { if (document.images) location.replace(location.href + '?' + (new Date()).getTime()); else location.href = location.href + '?' + (new Date()).getTime(); } var lastTime = location.search.substring(1) - 0; if ((new Date()).getTime() - lastTime > 1000) forceReload(); //--></script>