X
Tap here to go to the mobile version of the site.
Your Firefox is out of date and may contain a security risk! Upgrade Firefox

Support Forum

Recursive setTimeout becomes inactive through JavaScript console

  • No replies
  • 1 has this problem
  • 41 views
Posted

Hi,

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>

Modified by StanE

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1

More Information

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