|
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>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.