Trigger server action on page exit

Hi
I would like to know how can I trigger a server action when a user exit the current page to go to another page. This is possible?
Thanks

Community Page
Last updated: