Jump to content

Function on window close


emma57573

Recommended Posts

How do I perform a function on widow close

I want to log a user out of a session once they have exited my site.

Currently they are staying logged in until the they manually log out so if they just close the browser they are still showing as logged in and it messing my 'user online' script up.

 

I have the function I want to use ready Im just now sure how to tell it to work if the window closes.

 

Im asuming you can do this in PHP

Link to comment
Share on other sites

Thank you I looked into the java unLoad option and decided it was to unreliable so I have now killed the session after being inactive for 5 minutes and its working well.

The only thing if someones online a button apears 'chat with user' so someone could open a chat session within the 5 minutes the user has been inactive for and it obviously wont work which could be annoying for the user trying to chat.

If anyone knows of a reliable way to tell when a browser is closed I would love to hear it otherwise I think this will do for now.

 

Thank you for the advise.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.