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.

Process:
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.

Nilesh,

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.

Airshow

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

Thanks for confirming on my understanding too...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.