Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weizman/72c3697d62a74abde88cc2a0748bd3ab to your computer and use it in GitHub Desktop.
Save weizman/72c3697d62a74abde88cc2a0748bd3ab to your computer and use it in GitHub Desktop.
demonstration of how onbeforeunload and onunload properties all point to the same place
function listener() {}
const frameset = document.createElement('frameset');
const body = document.body;
window.onunload = listener;
window.onbeforeunload = listener;
body.onunload === listener; // true
body.onbeforeunload === listener; // true
frameset.onunload === listener; // true
frameset.onbeforeunload === listener; // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment