I am a newbee to JavaScript was was just fiddling around with events for a browser...

Is it possible to detect the browser process termination done through the Task Manager in windows.

1. Goto Task Manager
2. Right click on the browser process e.g. iexplorer.exe
3. Select "end process" to terminate the process

JavaScript can detect the window close by using body onunload event. On the similar bases, is it possible to detect the process termination event using JavaScript??

I tried a simple example using body onunload, but it failed to run the onunload event during the browser process termination. And i am of the opinion that this is not possible as all using JavaScript since terminating a process is a system / OS level task and is not related to browser events.

7 Years
Discussion Span
Last Post by nilesh.shinde


I just tried and got the same result - onunload doesn't fire if process is killed.

I guess you're right - terminating the process acts at too high a level. The javascript engine must die before it has a chance to respond.

That said, I tested with IE6 under win 2000. It's just possible that there may be differneces in bahaviour depending on browser and OS. However, it seems certain that you can't rely on the event firing for all users in an internet-served application.



Thanks for your prompt reply..
i can now firmly conclude that this is not possible!!

Thanks for confirming on my understanding too...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.