cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
549
Views
5
Helpful
3
Replies

Finesse Gadget not alerting agent trying to close Chrome/Edge browser

smeegada1
Spotlight
Spotlight

Gadget to alert agent when closing Chrome/Edge browser from Ready/Not_Ready status instead of Signout is not working.Alert logic is working but when user click LEAVE logic working as expected but when user click Cancel instead of staying on page it is throwing error. 

 

jQuery(document).ready(function () {
window.signoutClicked = false;

jQuery(window.top.document.body).find("#signout-text").click(function () {
window.signoutClicked = true;
});

if (window.onbeforeunload == undefined) {

window.addEventListener('beforeunload', function (e) {

if (window.signoutClicked || $(window.top.document.body).find("#connection-banner-disconnected").text().length > 0) {
if(window.signoutClicked){
window.signoutClicked = false;
}

return;
}
if (window.currentState && ( window.currentState === 'READY' || window.currentState === 'NOT_READY')) {
// Cancel the event
e.stopImmediatePropagation();
e.stopPropagation();
e.preventDefault(); // If you prevent default behavior in Mozilla Firefox prompt will always be shown// Chrome requires returnValue to be set
e.returnValue = true;
}

});

3 Replies 3

dekwan
Cisco Employee
Cisco Employee

Hi,

 

Can you be more specific to what error is thrown? Have you used the browser's debugger to see where the logic is going?

 

Thanx,

Denise

Hi Denise,

Let me post all the details for better understanding of the problem am facing.

-> When user try to close Chrome window from READY or NOT_READY, Pop up will be displayed(Refer Image1)

->When user click CANCEL and try to change state it is not working(Refer Image2)

 

Logs:-

Based on logs user is getting disconnecting after clicking CANCEL.I believe it is conflicting code in Finesse.JS which we dont have access.

2022-04-11T12:30:03.299 -04:00: : XXXXX: Apr 11 2022 12:30:13.993 -0400: Header : [ClientServices] MasterPublisher._connInfoHandler() - Connection status: unloading
finesse.js?nocache=1632418154652:13092 2022-04-11T12:30:03.302 -04:00: : XXXXX: Apr 11 2022 12:30:13.996 -0400: Header : FailoverMonitor._connectionUnloadingHandler(): unhooking disconnect handler.
finesse.js?nocache=1632418154652:13092 2022-04-11T12:30:30.802 -04:00: : XXXXX: Apr 11 2022 12:30:41.496 -0400: Header : [ClientServices] MasterPublisher._connInfoHandler() - Connection status: disconnecting
jabberwerx.js:864 closed: no error
EventTunnel.js:326 EventTunnel._connect(): cancel reconnect
EventTunnel.js:326 EventTunnel._connect(): called destroy
finesse.js?nocache=1632418154652:13092 2022-04-11T12:30:30.836 -04:00: : XXXXX: Apr 11 2022 12:30:41.530 -0400: Header : [ClientServices] MasterPublisher._connInfoHandler() - Connection status: disconnected

 

Is there a way we can reconnect/reestablish connection from JS code?

 

Please let me know if you need any additional info.

 

 

Hi,

 

Thanks for the clarification.

 

The only thing I can think of is it try to run through your init again. Maybe that'll help re-establish the connection.

 

If you want direct help in looking at your code and debugging, please open a DevNet support ticket: https://developer.cisco.com/site/support/

 

Thanx,

Denise