I need to clear the session variables when the tab is closed but I could not find any solutions so far. The closest I have got is by using the \"onbeforeunload\" function is
Yep you can do it,
Eureka! Google Yahoo