Interview Questions

Java Script Page Refresh

Use the following code to refresh a JSP or HTML page with the specified time period.

<script language="javascript">
var delay=10000; // time period for refresh in milliseconds
function startClock()
{
      window.location.reload();
}

function windowRefresh()
{
      setTimeout("startClock()", delay);
}
windowRefresh();
</script>

Add the above code in any JSP file. When the page is accessed in a browser, it will refresh for every 10000 milliseconds.