Question
2
Replies
477
Views
Cognizant technology solutions
Posted: March 27, 2019
Last activity: March 28, 2019
JavaScript required to detect browser/tab close event (Pega 7.4)
Hi All,
We need a JavaScript to detect browser close event, since need to update/persist the data's to external system on window/tab close.
We tried using onbeforeunload function, but the problem here is onbeforeunload is triggering on both window/tab close and window refresh.
We are using Pega 7.4.
Thanks in Advance.
The only way in Javascript to detect that browser/tab close are onunload & onbeforeunload events. But these events are also fired when we do a refresh or we press the browsers back button. I don't think you can natively detect a pure close in Javascript.