Click to See Complete Forum and Search --> : Javascript Stop Java Timer


sarakwok
10-17-2005, 03:07 PM
Hi,

In my javascript I starts a java timer to run a job. The user can click a "stop" button on my page to end the job (I would call timer.cancel) But if the user clicks the "x" button on the browser I have no way to cancel that java timer (basically I can't go to the class that I constructed the timer) and the job would keep running until I shutdown my web server. Is there anyway to hard kill all the java processes when user closes the browser? Any idea would be very much appreciated.



Sarah

HaganeNoKokoro
10-17-2005, 03:13 PM
You could probably use the javascript onunload event. That fires when the browser leaves your page (either closing or going to another page).

konithomimo
10-17-2005, 06:01 PM
You cannot do anything after the user closes the brower, at least not with javascript.

you could do something server side though where you check by IP to see who has your site open, and then when they leave "break" the program and end it.