• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to catch a user 'X' ing the tab?

My application uses only a single tab. When the user presses the regular "logoff" button my code runs the send_to_locker() function. But I also need to catch when users just X out the tab in the browser. How to do this? I tried putting the below line into my code but that doesn't seem to work. 

<body onbeforeunload="return send_to_locker()">

public function send_to_locker()
//some junk

Basically I am trying to store a user's "state" for the next time they visit. My code tries to send a few needed files to S3. If my server could somehow tell that the client is no longer connected,  that might do it. How can I do this?
proof that an old dog can learn new tricks

Messages In This Thread
how to catch a user 'X' ing the tab? - by richb201 - 04-07-2021, 04:02 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.