To to this you can add an onbeforeunload Javascript function. Please note that this doesn't work with some older browsers.
This is a basic example that should display a message when the window or tab is closed.
<html>
<head>
<script type="text/javascript">
window.onbeforeunload = function() {
return "Are you sure you wish to close this page?";
}
</script>
</head>
<body>
<h1>On Before Unload Test</h1>
</body>
</html>
<head>
<script type="text/javascript">
window.onbeforeunload = function() {
return "Are you sure you wish to close this page?";
}
</script>
</head>
<body>
<h1>On Before Unload Test</h1>
</body>
</html>
This should help prevent any lost work.
Done.
1 comment:
Thank you so much ...made it so simple :D
Post a Comment