Detecting Browser exit in PHP

browser, php

Solution

PHP is a server side language. Browser events are handled by DOM events. On "onunload" or "onbeforeunload" events, sending an AJAX call to a PHP file.

And in this other question there is a flavored explanation of what I'm saying.

Problem

I have looked at a few topics (here & google) regarding detecting browser exit in php and im not really any clearer on how to do so. I tried the `register_shutdown_function` in PHP but that was executing even when i refreshed the browser page. Can anyone help? Thanks in advance

Original source

Related problems