refresh page once
I've got a webpage that has information that needs to be updated on the fly. A problem I've encountered is that when I leave and return it doesn't update the page unless I refresh it. So I've written a function that refreshes the page on start, the problem is it refreshes constantly. Any ideas?
PS: On another note the function I've written would seem to work with onClick events. Could I get to this to work when the back button is pushed?
To make it refresh given an interval, use setTimeout() to call your function with a specified delay:
To make it refresh once, you could try using cookies to store session data. E.g. cookie with 5 minute expiration time in it set onload. Also in onload checks for existance of cookie. If not found, set cookie and refresh.
setTimeout("document.location = document.location; document.refresh()", 2000);