The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript On window close run Bootstrap Popup Reply To: On window close run Bootstrap Popup

Ilan Firsov

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: