Link to home
Start Free TrialLog in
Avatar of m_razesh
m_razesh

asked on

How to catch the browser close event to delete session - Problem while designing portal using JSF...

Hi all,

I am designing a portal using JSF. It has a user login for which I create a session.
I delete the session if the user clicks on logout. I also want the session to be
deleted when the user closes the browser window. How can I catch the event of
closing the browser??
I thought of using onunload() function but it is specified in some forums that
function specified for onUnload() will be executed either if we refresh the page or
if we close the browser window.

So this might not work for me. Please help me in figuring out a better option.

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of aaaaaa
aaaaaa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of m_razesh
m_razesh

ASKER

Hi,

Thanks a lot for the reply.
But this code is not working in the case of Mozilla.

I have another quick question:
How to call the JSF backing bean method from the JavaScript? Is there any way to do that??

Thanks again.
Rajesh
You can create a JSF form and call submit from javascript.
Can you provide a solution for the initial question? The above javascript solution will not work in mozilla. So i need something to work in Mozila. Can you help me on that.

Thanks & Regards
Uday