JavaScript Tutorial – "unload" event | Detect when the browser window has closed




By using the “unload” event in JavaScript you are able to detect when the window has closed. In the case of an iframe, it is possible to detect when the src attribute has been removed or changed.

In this video we take a look at an example of the “unload” event in the case of an iframe, where we send a message to the parent window when the child window (within the iframe) gets un-loaded.

Support me on Patreon:
https://www.patreon.com/dcode – with enough funding I plan to develop a website of some sort with a new developer experience!

For your reference, check this out:
https://developer.mozilla.org/en-US/docs/Web/Events/unload

Follow me on Twitter @dcode!

If this video helped you out and you’d like to see more, make sure to leave a like and subscribe to dcode!

Original source


3 responses to “JavaScript Tutorial – "unload" event | Detect when the browser window has closed”

Leave a Reply