electron/spec/fixtures/api/close-beforeunload-empty-string.html

20 lines
450 B
HTML
Raw Normal View History

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