Home > Uncategorized > How to cancel any outstanding javascript on a page

How to cancel any outstanding javascript on a page

If you have a webpage, and you need to stop all javascript routines from running. That is, any routine started by setTimeout, and executing in a separate thread. Even if you do not have a reference to the value returned by setTimeout, then you can just clear all timeouts as follows;

var maxTimeout = setTimeout(‘null’,1);
for(i=0;i<maxTimeout;i++)
{
clearTimeout(i);
}

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment