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

18 lines
417 B
HTML
Raw Normal View History

2017-04-25 23:14:34 +00:00
<html>
<body>
<script type="text/javascript" charset="utf-8">
// Only prevent unload on the first three window closes
var unloadPreventedCount = 0;
window.onbeforeunload = function() {
setTimeout(function() {
require('electron').ipcRenderer.sendSync('onbeforeunload')
2017-04-25 23:14:34 +00:00
}, 0);
if (unloadPreventedCount < 3) {
unloadPreventedCount++;
return false;
}
}
</script>
</body>
</html>