I am trying to trigger a function in my vue.js app only when the user closes the app. I already found the possibility to register an event listener for beforeunload
. Using this event, the function will also trigger when the page is just reloaded - which is not really what I want.
Can anybody tell me if there is a way to prevent beforeunload
from triggering on refresh? Or is there a completely different way to fire a function whenever my page is closed?
Thank you in advance! :)