From bd2effd89c7997df5c81cad99fa873ab63f65397 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Mon, 13 Jul 2026 10:56:29 -0500 Subject: [PATCH] @ feat(runbackup): open record link in new window; harden leave warning - The "View backup record" link on the pre-update completion screen now opens in a new window (target=_blank rel=noopener), so viewing the record does not leave the "Continue the update" flow. - beforeunload leave-warning now also returns the message (broader browser support) so closing the window mid-backup reliably prompts a warning. Claude-Session: https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i @ --- .../com_mokosuitebackup/tmpl/runbackup/default.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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) { -- 2.52.0