feat(firefox): support running beforeunload hooks when closing (#4003)

This commit is contained in:
Andrey Lushnikov
2019-02-13 22:16:12 -08:00
committed by GitHub
parent e3b76b2beb
commit 0b40d04b99
5 changed files with 28 additions and 9 deletions

View File

@@ -1,5 +1,10 @@
<div>beforeunload demo.</div>
<script>
window.addEventListener('beforeunload', event => {
// Chrome way.
event.returnValue = 'Leave?';
// Firefox way.
event.preventDefault();
});
</script>