How to get the number of tabs opened of my web in a browser using jquery?

I am looking a way to know how many tabs are opened of my web in a browser. Basically my purpose is to handle "keep me logged in" check. But the issue is when I do not checked that checkbox and open multiple tabs then if I close a single tab, It removes my session. I want to know if the user has not checked the "keep me logged in" checkbox and then he closes the last tab of my web then I should destroy his session.

I guess (and hope) you can't because that would mean you would have access to the users private data – e.g. which URL's he has open in another tab.

What you are trying here is a privacy nightmare to me…

You should use cookies to check if you are logged in. You should not get to know what other sites user is seeing or how many other sites he is seeing