I am facing an issue in handling the browser window close in javascript (i.e window/tab close button) for Safari browser (Mac and IPad).
I have a javascript function rdcBeforeUnLoadAction to logout the application and show a confirmation alert before closing the window. rdcBeforeUnLoadAction is called on beforeunload event from adf in clientListener as below.
<af:clientListener method="rdcBeforeUnLoadAction" type="beforeunload"/>
Browsers behavior:
- IE11 - It works as expected, it logs out the application and shows the alert.
- Safari (Mac Book) – It shows the alert with options (Stay on Page and Leave Page)
The issue here is that the logout does not happen on Leave page and the alert message is returned and displayed. So is there any way to handle this so that the application logs out on browser window close?