Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Trigger event when browser window / tab is closed

Ruchi19
Mega Contributor

I m trying to create an event when the browser window / tab is closed. Can window.onunload function be called? if so, from where?
I see session.established event is created everytime the new session is established. Similarly, i want to trigger another event when window / tab is closed.
any idea / suggestion how to do this?

2 REPLIES 2

adiddigi
Tera Guru

You can write a onUnload function on the UI Page corresponding to that window,I haven't tried this. Just an idea.
http://www.w3schools.com/jsref/dom_obj_event.asp
You can use the onUnload function as listed in that URI provided.

Thanks


Ruchi19
Mega Contributor

Thanks Abhiram. But I would like this function to be called irrespective of page User is on.