diff --git a/source/packages/com_mokosuitebackup/tmpl/runbackup/default.php b/source/packages/com_mokosuitebackup/tmpl/runbackup/default.php index 6b2f0a3d..06fe95ad 100644 --- a/source/packages/com_mokosuitebackup/tmpl/runbackup/default.php +++ b/source/packages/com_mokosuitebackup/tmpl/runbackup/default.php @@ -132,7 +132,7 @@ $this->getDocument()->addStyleSheet(Uri::root(true) . '/media/com_mokosuitebacku
@@ -316,9 +316,15 @@ $this->getDocument()->addStyleSheet(Uri::root(true) . '/media/com_mokosuitebacku } } - /* Warn before leaving while a backup is mid-flight. */ + /* Warn before closing/leaving the window while a backup is mid-flight. + Return the message too — some browsers need it, others show a generic + prompt, but any non-empty value triggers the confirmation dialog. */ window.addEventListener('beforeunload', function (e) { - if (running) { e.preventDefault(); e.returnValue = L.leaveWarn || ''; } + if (!running) { return undefined; } + var msg = L.leaveWarn || 'A backup is in progress. Leaving now will cancel it.'; + e.preventDefault(); + e.returnValue = msg; + return msg; }); if (CFG.autostart) {