From f777f2fdeb9ae1a6a0a1d9fcd1f229bd3efd146e Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Mon, 8 Jun 2026 18:55:35 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9(addon)=20show=20fallback=20message?= =?UTF-8?q?=20when=20dialog=20cannot=20auto-close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dialog window does not close itself on Outlook Desktop, which opens links in a webview that behaves like a different browser. Calling window.close() fails because, for security reasons, JS is prevented from closing the window. The browser considers that the JS script is not the one that opened the dialog. The dialog also loses its reference to the opener due to the redirection, so there is no way to message the parent to trigger a close. Keeping the dialog reference on the parent side does not help either: since the opener is lost, the parent cannot call close on the dialog. After investigation, go with a temporary solution that shows an explicit message hinting the user to close the dialog manually if it does not close automatically. --- src/addons/outlook/src/success/success.html | 3 +++ src/addons/outlook/src/success/success.js | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/addons/outlook/src/success/success.html b/src/addons/outlook/src/success/success.html index 2ac114b3..d1603e88 100644 --- a/src/addons/outlook/src/success/success.html +++ b/src/addons/outlook/src/success/success.html @@ -40,5 +40,8 @@ + diff --git a/src/addons/outlook/src/success/success.js b/src/addons/outlook/src/success/success.js index 0c2da273..ccd0082d 100644 --- a/src/addons/outlook/src/success/success.js +++ b/src/addons/outlook/src/success/success.js @@ -11,10 +11,18 @@ if (!transitToken) { window.close(); } else { exchangeSession(transitToken) + .then(() => { + document.querySelector(".spinner-container").style.display = "none"; + document.querySelector("#close-msg").style.display = "block"; + }) .catch((e) => { console.error(`Error occured: ${e}`); }) .finally(() => { + // NOTE: doesn't work with the desktop client — the browser considers + // this window wasn't opened by this script (it was opened externally), + // so it blocks window.close() for security reasons. The "#close-msg" + // shown above is the fallback for that case.g window.close(); }); }