I am a relative amateur to client-side scripting, as I come from a server-side background. My task is this: I would like for my browser to hit an external url frequently, (or for 100 attempts, whichever comes first), to check if it has been updated. If it has been updated, the browser stops refreshing and performs some other task.
This is where I am so far:
while (i<=100)
{
window.location=”
[checking to see if the page is updated..]
if (Updated == true) {
i=100; }
else {
i++; }
}
The only way I can think of to do something like this is to type this code into the address by via javascript:while (i<=100)…. but as soon as the window.location changes (ie the page refreshes) the code is gone forever, ie, the loop ends.
Is there a better way to do all this? I’m a javascript retard so i assume there MUST be a better way! Perhaps run this in a background thread? (is that even possible?) Thanks!