Dup Ver Goto 📝

How to show confirmation of unsaved changes

PT2/lang/js/web web js does not exist
To
14 lines, 22 words, 357 chars Page 'ConfirmOnClose' does not exist.

From this stackoverflow

function onBeforeUnload(e) {
    if (thereAreUnsavedChanges()) {
        e.preventDefault();
        e.returnValue = '';
        return;
    }

    delete e['returnValue'];
}

window.addEventListener('beforeunload', onBeforeUnload);