nightmare
Version:
A high-level browser automation library.
18 lines (17 loc) • 430 B
HTML
<html>
<head>
<title>Unload</title>
<script>
var unloadHandler = function (event) {
var confirmationMessage = 'Are you sure?';
event.returnValue = confirmationMessage;
return confirmationMessage;
};
window.addEventListener('unload', unloadHandler);
window.addEventListener('beforeunload', unloadHandler);
</script>
</head>
<body>
</body>
</html>