Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!not-for-mail From: Xox Newsgroups: comp.lang.javascript Subject: Shutting script down when leaving page Date: Mon, 27 Jan 2014 03:25:17 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 14 Message-ID: NNTP-Posting-Host: pool-74-108-80-123.nycmny.east.verizon.net Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1390793117 11990 74.108.80.123 (27 Jan 2014 03:25:17 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Mon, 27 Jan 2014 03:25:17 +0000 (UTC) User-Agent: Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2) Xref: csiph.com comp.lang.javascript:22811 Let us suppose I have a page, a.html, which contains a script which constantly invokes itself or is invoked -- it's running not necessarily continuously but at regular intervals, or maybe it is looping. In any case it's active. Now the viewer goes to an entirely different page using the same window/tab, so a.html has disappeared. It seems reasonable to assume that the script would stop running. But is this in fact known to be the case across all contemporary browsers? The reason I ask is that I observed some CPU usage which seemed to indicate that something was going on after the page had been left. The script I am dealing with could be costly in terms of CPU and if it continues to run I should shut it down explicitly when the browser leaves the page.