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

18 lines
422 B
HTML
Raw Normal View History

2017-04-25 23:14:34 +00:00
<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')
2017-04-25 23:14:34 +00:00
}
</script>
</body>
</html>