Question
How to detect the browser’s close button in browser tab?
Hi,
I have a non Pega application launching a Pega application from any browser but they both are running in 2 different tabs of same session. Now I want to close the Pega application from the browser tab using “X” button but I want to make a server call while closing the browser tab. Tried all possible ways mentioned in the PDN and tried with HTML/JS but no luck. First of all, I am unable to detect the browser’s “X” button. Can any of the experts pls help me? Pls don’t post/show any existing PDN articles in this discussion since I did check end to end in PDN site. Pls help me for those who got successful in this don’t context. That way the time will be saved for both of us.
Thanks,
Ravi Kumar.
***Edited by Moderator: Pallavi to update platform capability tags***
Hi Ravi,
I did a small POC to detect tab close event in Pega 8.4. I can able to achieve using the below code in UserWorkForm rule.
The above code listens for Tab close, Reload, and Browser close events.
I used https://beeceptor.com/ to create a dummy service and to test whether the service is invoked.
I hope it helps you a bit.
Good Luck!