Showing results for 
Search instead for 
Did you mean: 

Recursive setTimeout becomes inactive through JavaScript console

New Contributor

Recursive setTimeout becomes inactive through JavaScript console


I'm using setTimeout() recursively in functions which stops working completely as soon as I trigger an alert-box (alert()) from the JavaScript console. Calling alert() from the document's code itself does not have this effect. Refreshing the site F5 or hard refresh Ctrl+F5 reloads the page but doesn't start the timers. The only way to restore the site completely and get setTimeout() to work again is to close and open the tab or browser again. This seems to be a bug, I think. I'm using Firefox 15.0.1 on Win 7 64-bit.

See example below. The code below keeps displaying the time in the window's title after clicking the button. If you execute "alert();" from the JavaScript console instead, it stops all setTimeout() functions and does not reactivate them even if you reload the page.

Edit: Sorry, heres the code:

<script> function init() { callself(); } function callself() { var now = new Date(); document.title = now.toLocaleString(); setTimeout("callself()", 100); } </script> <button onclick="javascript: alert('');">click me</button>