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
https://forums.phpfreaks.com/topic/116550-function-on-window-close/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.