|Timer not accurate|
Timer not accurate, off my minutes not seconds
| 8:59 pm on Mar 5, 2012 (gmt 0)|
Hi, I have a question about an automatic redirection timer. Is there a script that is more accurate than the one shown below?
I ask this, because the one I am presently using is not accurate at all. I can live with a 40-60 second difference, but in using FF 8.0.1, it won't kick in till about 2-5 minutes later.
I did search in the forums for quite a while, but did not find anything.
Here is my code:
curtime=curmin+" minutes and "+cursec+" seconds left"
curtime=cursec+" seconds left"
| 9:32 pm on Mar 5, 2012 (gmt 0)|
Not sure what you mean by "it won't kick in till about 2-5 minutes later". Later than what? And what won't kick in? You're starting this onload, which means it won't start until all DOM elements have loaded, including all images, scripts, etc. So if you have advertising code that is taking a long time to load, that could affect this script.
Another approach might be to create a Date object to act as a timestamp, and then periodically sync with that. For example, over time your script will probably take longer than 60 minutes, simply because of the overhead with the script. However, you could keep some separate counter that on every 60th iteration re-synchronizes with the timestamp (creates a new Date object, calculates the difference from your original timestamp, and adjusts the numbers on your countdown appropriately).
| 9:37 pm on Mar 5, 2012 (gmt 0)|
When the 60 minutes are up (I kept tabs on the time), the script does not redirect the page till a few minutes later. I do not have any images or advertising code at all, just text.
| 9:43 pm on Mar 5, 2012 (gmt 0)|
Here's an example that synchronizes every 10 seconds:
| 9:45 pm on Mar 5, 2012 (gmt 0)|
Oh, that's weird.
| 9:56 pm on Mar 5, 2012 (gmt 0)|
Thank you, I will give that a try. Very much appreciated
| 10:56 pm on Mar 5, 2012 (gmt 0)|
One hour has passed and I have some very good news, it worked beautifully! Right on the button :) Thanks again, I appreciate it very much!