electron/spec/fixtures/api/close-beforeunload-empty-string.html
2016-08-03 16:23:39 -07:00

19 lines
428 B
HTML

<html>
<body>
<script type="text/javascript" charset="utf-8">
// Only prevent unload on the first window close
var unloadPrevented = false;
window.onbeforeunload = function() {
setTimeout(function() {
require('electron').remote.getCurrentWindow().emit('onbeforeunload');
}, 0);
if (!unloadPrevented) {
unloadPrevented = true;
return '';
}
}
window.close();
</script>
</body>
</html>