electron/spec-main/fixtures/api/beforeunload-false-prevent3.html

17 lines
422 B
HTML

<html>
<body>
<script type="text/javascript" charset="utf-8">
function installBeforeUnload(removeAfterNTimes) {
let count = 0
window.addEventListener('beforeunload', function handler(e) {
setTimeout(() => console.log('beforeunload'))
if (++count <= removeAfterNTimes) {
e.preventDefault();
e.returnValue = '';
}
})
console.log('installed')
}
</script>
</body>
</html>