0

I'm trying to set up some logging in my CakePHP application and I want a specific session to delete at browser close, however CakePHP is saving the session somewhere. What can I do to have only that specific session deleted on browser close?

Marco Veenendaal
  • 186
  • 1
  • 12

1 Answers1

1

That's not possible. See javascript detect browser close tab/close browser

If I get you correctly, you want to know when a tab/window is effectively closed. Well, afaik your only way in Javascript to detect that kind of stuff are onunload & onbeforeunload events.

Unfortunately (or fortunately?), those events are also fired when you leave a site over a link or your browsers back button. So this is the best answer I can give, I don't think you can natively detect a pure close in Javascript. Correct me if I'm wrong here.

Community
  • 1
  • 1
floriank
  • 25,546
  • 9
  • 42
  • 66