При возврате строки из обработчика события onbeforeunload
отобразится диалоговое окно.
<html>
<head>
</head>
<body>
test
<script>
window.onbeforeunload = function () {
return "*** Warning: changes are not saved! ***";
};
</script>
</body>
</html>
В Internet Explorer этот диалог выглядит так:
---------------------------
Windows Internet Explorer
---------------------------
Are you sure you want to navigate away from this page?
*** Warning: changes are not saved! ***
Press OK to continue, or Cancel to stay on the current page.
---------------------------
OK Cancel
---------------------------
Ваш текст будет помещен между некоторыми текстами браузера, но это единственный способ.