Question

1
Replies
236
Views
Close popover
Paige Robinson (PaigeR11)
United Health Group
Paige Robinson
United Health Group
US
PaigeR11 Member since 2014 6 posts
United Health Group
Posted: March 7, 2018
Last activity: March 7, 2018
Closed

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(!p){
/  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);
//window.open(oSafeURL.toURL(), null,[]);
}
else{

/  alert("Refresh");
}

});

Moderation Team has archived post