One of my customers wants to replace some Forms applications using APEX. One of the critical issues was the possibility to warn the user before exiting the existing form (switching tabs, closing browser window or tab or simply using the back button). In this example in my Demo Application I created a proof of concept using some older threads and demos. The solution is quite neat since there is almost no hardcoding and it works in every case while trying to move from the form. One of the important things was how to get that button for saving changes work, so it doesn't trigger the alert but does save the changes.