Here is the simplest code to play that I could think of:
ms = 30;
num = 1;
function test()
{
num+=ms;
document.getElementById('Submit').value = num;
if (num < 4000)
window.setTimeout(test, ms);
}
test()
I set ms (milliseconds between iterations) to 30, ran the script and moved to another tab in the browser.
Then I wait about 10 seconds (the script should end in 4 seconds) and will return to the tab.
If I used Firefox, I saw that the script is not finished yet, and the numbers are still working (resuming from where I left them, I think).
What annoys
But if I changed msto 1000 and repeated the above steps, when I return to the tab, I saw that the script has already been completed.
(It takes 4 seconds to complete the script).
, Firefox window.setTimeout, , . ,
, Internet Explorer.
script, . , ms.
, ? ?
DOM , setInterval ( ).
, .
, , .
- , / , .
, .
, , , / .
Firefox 25.0.1 IE 11. (Windows 7)