PaigeR11 Member since 2014 6 posts
United Health Group
Posted: 2 years ago
Last activity: 2 years 7 months ago

Browser/Tab close for logoff event

We have a requirement to capture logoff on browser or tab close.

The client cannot enforce using the logoff feature.

We created TabCloseEventDetection(displayed below) which displayed a pop up box to the user when the tab or browser was closed. The User selects "OK" at which point they are logged off and the event recorded in the database.

The issue we are facing is upon auto logoff. When Pega auto logs out the Java script is also detected. The pop up box is displayed to process the logoff but because the user is not available to select, the logoff event is not completed.

Has anyone faced a similar requirement and what was the solution?

window.addEventListener("beforeunload", function (e) {
var confirmationMessage = "o/";
var p = (e || window.event).returnValue == confirmationMessage;
/  if(true){
//pega.u.d.replace('pyActivity=LogOff&pzPrimaryPageName=pyDisplayHarness', null);
alert("You will be Logged off");
var oSafeUrl = new SafeURL("@baseclass.LogOff");
var request = pega.u.d.asyncRequest('GET',oSafeUrl);
//, null,[]);

/  alert("Refresh");


Moderation Team has archived post
Share this page LinkedIn