Currently trying to run a function through the window.addListener('unload') event. This is the code I am trying to run:
window.addEventListener('unload', this.returnToDashboard)
returnToDashboard():
location.href = './'
The event gets triggered on Firefox but does not work on Chrome. My Chrome Version is: Version 104.0.5112.79 (Official Build) (x86_64)
Not sure why it is not working on Chrome. Any insight would be appreciated on alternatives. Thank you.
Update:
According to the MDN docs I am supposed to be using pagehide event but that does not trigger for Chrome either.