0

Possible Duplicate:
How can I clearInterval() for all setInterval()?

I called setInterval in my page, and I don't have access to the original variable that setInterval was stored in, but I want to clear it from my page.

so how can i clear all timers present on a page?

Community
  • 1
  • 1

1 Answers1

2

Clear ALL the intervals!

// This could take a while.
for (var i=0; i<2147483647; i++) clearInterval(i);

You could probably tone down that max value of i and still catch 'em all. The above code finished in my browser after only 12008757 milliseconds. That's 3.3 hours, or ~179 clearInterval()s per millisecond.

Matt Ball
  • 354,903
  • 100
  • 647
  • 710