Count of tabs opened in a browser close event

Hi,
how to find out the how many tabs opened in a browser, when i click on close button of browser. And also is there any separate events for tab close and browser close.
Can any one please give me solution for this.

Regards,
Mani.

There are no tab close or browser close events. The closest is the web page unload event that is triggered when a web page is unloaded regardless of whether it is simply to reload the same page, load a different page or because the tab or browser has closed.

If it is possible to do what you want it would have to be done as a browser plugin as scripts running in the browser itself or in a web page will not have the necessary security access.