I have seen many websites that detect if you've entered something into a field or touched some control and then try to switch away from the page. They then pop up a dialog box saying something like "you have unsaved changes, are you sure you want to leave?"