Цей вебсайт матиме обмежену функціональність, доки ми проводимо його обслуговування для поліпшення роботи. Якщо прочитана стаття не розв'язала вашу проблему і ви хочете поставити питання, наша спільнота підтримки з радістю допоможе вам на @FirefoxSupport у Twitter та /r/firefox на Reddit.

Шукати в статтях підтримки

Остерігайтеся нападів зловмисників. Mozilla ніколи не просить вас зателефонувати, надіслати номер телефону у повідомленні або поділитися з кимось особистими даними. Будь ласка, повідомте про підозрілі дії за допомогою меню “Повідомити про зловживання”

Докладніше

Ця тема перенесена в архів. Якщо вам потрібна допомога, запитайте.

Javascript setTimeout and setInterval are ignored.

  • 5 відповідей
  • 13 мають цю проблему
  • 2 перегляди
  • Остання відповідь від IceMetalPunk

more options

While working on my website (I'm a web developer), I noticed a strange thing about Firefox 6.0 and above: setTimeout and setInterval don't seem to work at all. They used to, but ever since I upgraded past 6.0 (I'm currently using 7.0.1), they're just ignored.

They return a valid handle, but the functions they're supposed to trigger just never execute. For example, if I try this code:

timer = setTimeout(doSomething, 1000);

"Timer" is a valid ID, but doSomething never executes. Even if I wrap doSomething in an anonymous function, still nothing happens. And as I've said, the problem is with setTimeout as well as setInterval.

While working on my website (I'm a web developer), I noticed a strange thing about Firefox 6.0 and above: setTimeout and setInterval don't seem to work at all. They used to, but ever since I upgraded past 6.0 (I'm currently using 7.0.1), they're just ignored. They return a valid handle, but the functions they're supposed to trigger just never execute. For example, if I try this code: timer = setTimeout(doSomething, 1000); "Timer" is a valid ID, but doSomething never executes. Even if I wrap doSomething in an anonymous function, still nothing happens. And as I've said, the problem is with setTimeout as well as setInterval.

Усі відповіді (5)

more options

A good place to ask advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
The helpers at that forum are more knowledgeable about web development issues.
You need to register at the mozillaZine forum site in order to post at that forum.

See http://forums.mozillazine.org/viewforum.php?f=25

more options

Thanks. I've just posted the problem there and am awaiting a response.

Upon further testing, it seems that the same timeout will sometimes work and other times be ignored. Without changing anything, simply reloading the page makes the timeouts work or not seemingly "randomly". The weird thing is that when the timeouts don't work, they won't even work if I set a new timeout from the Scratchpad, but when they do work, they work from both the page and the Scratchpad.

more options

Do you see any errors in the Firefox > Web Developer > Error Console ?

more options

Not a single error or warning. That's the most annoying part is that Firefox is acting as if everything executed just fine, but it's not actually executing the function.

more options

Well, I've just figured out what causes this problem. If I use the Scratchpad to show an alert (which I often do while testing my website as I develop it), then the tab that was open stops responding to any timeouts or intervals. If I go to another page in that tab, they still don't work. Only if I close the tab and open a new one do the timeouts begin working again.

Sounds like a bug to me. Where do I report bugs to Mozilla?