03-29-2016 04:07 AM
Hi, all.
I am working with finesse in the sandbox lab.
How can I catch the window.unload event?
I have the following code in gadget init function.
$(window).on('unload', function() {
var x ="unload";
return x;
});
This code works on any other webpage. Similar code works for "beforeunload" event in finesse.
But finesse ignores it, when I am closing the page, even if I am setting the breakpoint in this function.
What am I doing wrong? Maybe I missed something?
Thank you.
With regards, Yuriy.
t
Solved! Go to Solution.
03-29-2016 03:54 PM
Hi,
Take a look at the jquery documentation about unload: https://api.jquery.com/unload/
According to that documentation,
The exact handling of the unload
event has varied from version to version of browsers. For example, some versions of Firefox trigger the event when a link is followed, but not when the window is closed.
I put the code you pasted above into the gadget's init (SampleGadget*.js). When I added a link to the gadget (make sure the link is https to avoid the mixed-mode browser error) and followed it, the unload is triggered. If I closed the window, it didn't trigger the unload.
Thanx,
Denise
03-29-2016 03:54 PM
Hi,
Take a look at the jquery documentation about unload: https://api.jquery.com/unload/
According to that documentation,
The exact handling of the unload
event has varied from version to version of browsers. For example, some versions of Firefox trigger the event when a link is followed, but not when the window is closed.
I put the code you pasted above into the gadget's init (SampleGadget*.js). When I added a link to the gadget (make sure the link is https to avoid the mixed-mode browser error) and followed it, the unload is triggered. If I closed the window, it didn't trigger the unload.
Thanx,
Denise
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: