I need to warn users about unsaved changes before they leave a page (a pretty common problem).
window.onbeforeunload=handler
This works bu
What about to use the specialized version of the "bind" command "one". Once the event handler executes the first time, it’s automatically removed as an event handler.
$(window).one("beforeunload", BeforeUnload);