Issue #114: popup warning on tab/window close

JS `window.onbeforeunload` handler was added, and it will be
trigger if session is active.

Reference: 6693512fde244cbb7f10e0033d4b4e5ec1b20e32
This commit is contained in:
KLuka 2015-03-05 15:46:13 +01:00
parent 79574d8ac4
commit 618999f3cc

View file

@ -99,6 +99,16 @@
'</style>');
}
})();
// User warning on window close
window.onbeforeunload = function(e) {
if (typeof window.shellinabox.session != "undefined") {
return "Are you sure you want to leave this page?";
} else {
return null;
}
}
--></script>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<script type="text/javascript" src="ShellInABox.js"></script>
@ -107,7 +117,7 @@
correctly deal with the enclosing frameset (if any), if we do not
do this
-->
<body onload="setTimeout('new ShellInABox()', 100)"
<body onload="setTimeout('window.shellinabox = new ShellInABox()', 100)"
scroll="no"><noscript>JavaScript
must be enabled for ShellInABox</noscript></body>
</html>