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);
}

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: