Support Article
pyOnBeforeWindowClose not triggered on browser close event
SA-40697
Summary
When users just close the browser rather than clicking logoff, there needs to be a way to gracefully clear out their requestor sessions. The pyOnbeforeWindow activity is usually triggered by the browser close button event, but if the section includes a Dynamic container.
Error Messages
Not Applicable
Steps to Reproduce
1. Launch the Case Manager portal. Click on the X to close the browser window. If you trace this action, you will see a call to pyOnBeforeWindowClose activity.
2. Now do a private edit of pyPortalContent rule, remove the existing dynamic container.
3. Drop a new dynamic container. By default it is single document mode.
4. Repeat step 1 as above. This time you will not see a call to pyOnBeforeWindowClose.
Root Cause
The portal in question was configured in a frameless (single document) mode. In this case, upon each user action (such as a click of a button), the complete window gets unloaded and loaded again, so if the activity is allowed to be invoked. In that case every user action will lead to release of locks held by requestor, which shouldn't happen as it is not a browser close, so we avoid invoking the activity when in a frameless mode. For such portals, the mechanism of detecting heartbeat absence will mark the requestor as disconnected.
Resolution
Continue to use the frameless portals and rely on the automatic heartbeat mechanism to disconnect the requestor.
OR
Switch the portal to be in 'multi document' mode so that its not frameless, and it will invoke the activity explicitly on browser close.
Published August 26, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.