I have a website with a timer. When the timer reaches zero we send an ajax request to the server to get the next time and reset the countdown.
The problem is when I leave the webpage open overnight and comeback the next day, the timer has failed to stay updated. When my computer is asleep, the ajax request seems to not work. I have to refresh the page to get it to work again.
I see other sites are able to handle this. What technology are they using?
For example, if I leave Google Finance open over night as soon as I switch to the tab the next day all charts are already up-to-date with no refresh.
Do you need to use web workers to get this to work? Or is there some other technology I don’t know about? Or should my technique work in theory?