Stop users from navigating away from a "page" when new document or edit is unsaved
I am looking to configure or add a mechanism to prevent users from navigating away from an edit (or new document) before they click the save button. At a minimum I would like to pop-up a warning to inform the user that they have unsaved content and are they sure they want to lose it.
I would like to do this without having to modify core elements (to maintain ease of future updates) so I am looking for some guidance as to the best approach to achieve this result.
I would start with something akin to http://misterdai.wordpress.com/2010/06/04/jquery-form-changed-warning/ (probably simplified at first).