I\'d like to warn users when they try to close a browser window if they didn\'t save the changes they made in the web form.
I\'m us
as others have mentioned, you'll want to look at the window.onunload/onbeforeunload events. The problem with this event is that it is called whenever the page is unloaded. Not only when the browser window is closed, but also when you click on a link within the same browser window to go to a different page on the same site. You still may be able to do what you want to do, but it helps if you can anticipate this behaviour.