Question
LANIT-BPM
RU
Last activity: 25 Feb 2016 7:12 EST
How to specify some actions on Tab close event
Hi!
I have an application where work objects are opened as a new window (tab). I want to specify some action for tab closing event(call activity, call data transform, for example)/ But I Have No idea ho to do this. I found an activity Work- DoClose but it is final and there are no extension points in it.
Also I found a PDN article, where i saw the following script:
window.onbeforeunload = function(e) {
document.getElementById('hiddenfieldname').fireEvent('onchange');
}
hiddenfieldname is a Hidden Text control where I can specify actions on Action tab. But this function does not work. I tried to replace document.getElemetByID....... with alert('123'); but it takes no effect.
Please, tell me, is it possible to extend this tab close event?
P.S.
Browser: Chrome, IE
PRPC 7.1.8
Thanks.
Mikhail Ilyin
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi
Please go thru this mesh post : Re: Session Log off upon browser close It discuss about how to capture this kind of event. You can get some idea from there. Also check this article :https://community.pega.com/support-articles/requestor-session-not-terminated-browser-or-tab-close
LANIT-BPM
RU
Hi Santanu
Thak you for your links, but i is not working too/ I tried this on multiple browser such as Chrome, IE Firefox, but it takes no effect
Pegasystems Inc.
IN
Hi
Can you please elaborate what you meant by not working ? Is it you are not able to capture the event at all ? Or is it like you are able to capture the event but failing to run the activity ?
LANIT-BPM
RU
I can not capture this event at all.
I simplified the code of arcticle:
<script>
window.addEventListener('beforeunload', CallAppCloseWindow, false);
function CallAppCloseWindow(e)
{
alert('close');
}
</script>
And there is no alert message when i'm closing a tab
Pegasystems Inc.
IN
Hi
I put the bellow code in userworkform HTML fragment and I am able to fire it when trying to close a browser window. I tested it with Chrome and IE
<script>
window.onbeforeunload = function (event) {
var message = 'Important: Please click on \'Save\' button to leave this page.';
if (typeof event == 'undefined') {
event = window.event;
}
if (event) {
event.returnValue = message;
}
return message;
}
</script>
If this works then you need customize it further to fire an activity !
LANIT-BPM
RU
Pegasystems Inc.
IN
Hi
In that case, dont use the code in userworkform. Make a JS file and update your harness to use the script. Else, create a section, put the code in the section and then embed the section in the parent harness.
LANIT-BPM
RU
Hi
Sorry, but all this two cases you described are not working.
Pegasystems Inc.
US
The close button you are pointing at I would imagine is available. Could you add a on click event coupled to this button to call an activity? This is something I have seen done in similar setups.
LANIT-BPM
RU
Hi!
Thanks everyone for help
I fond activity "CloseDefaults" that can be overrided and specified some steps in it. But be very careful with it
Mikhael