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

16 lines
393 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 = '';
}
})
}
</script>
</body>
</html>