Home › Forums › JavaScript › On window close run Bootstrap Popup › Reply To: On window close run Bootstrap Popup
September 28, 2014 at 6:59 am
#184890
Participant
You can’t really do this, but you can show a message to alert the user he has unsaved changes.
Add a listener for the beforeUnload event and return a string value for a message (will not show on all browsers), when the user saves the changes remove the listener – you can’t just return null or false value, you must remove the listener
A quick demo:
http://codepen.io/ilanfir/pen/Jjlky