I am looking for a solution in my vue.js app to execute a function only when the user closes the application. I have tried registering an event listener for beforeunload
, but it causes the function to also trigger on page reloads, which is not ideal.
Is there a way to prevent beforeunload
from activating on refresh, or perhaps a different approach to running a function when the page is closed?
Your insights would be greatly appreciated! :)