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

Q1238 Using JavaScript how can I force the browser to reload the current page every second from the server?

irt.org | Knowledge Base | JavaScript | Misc | Q1238 [ previous next ]

Q1238 Using JavaScript how can I force the browser to reload the current page every second from the server?

If the following is saved as test.htm then it'll reload itself every second.

Watch the URL bar!

<html>
<head>
<script language="JavaScript"><!--
function reloadFunction() {
    // assuming url of:  test.htm - eanables me to test
    // may need to parse location.href if the url is not fixed
    location.href = 'test.htm' + '?' + ((new Date()).getTime());
}
//--></script>
</head>

<body onLoad="setTimeout('reloadFunction()',1000)"> <!-- invoke reload after 1 sec -->

<body>
</html>

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.