Do you really want to exit?” or “Do you really leave this page without saving?” and similar… useful messages in all types of application, also in the web ones. How can we implement it? It is very simple!!

The key is the WindowEventHandlers.onbeforeunload event, fired when a window is about to unload its resources.

You can use this little snippet:

<script type=”text/javascript”>
    window.onbeforeunload = function()
            return “Do you really leave this page without saving?”;