From c9c70d08c680c8655e780c0737a977f1e50d4187 Mon Sep 17 00:00:00 2001 From: Franco Zalamena Date: Tue, 7 Apr 2026 16:00:33 +0100 Subject: [PATCH] Add configurable option to control URL open target Add `openLinksInNewTab` static property to `IterableConfig` that controls whether URLs are opened in a new tab (`_blank`) or the same tab (`_self`). Defaults to `true` for backward compatibility. Fixes #425 Co-Authored-By: Claude Opus 4.6 --- src/utils/IterableActionRunner.ts | 3 ++- src/utils/IterableConfig.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/IterableActionRunner.ts b/src/utils/IterableActionRunner.ts index 67bd9326..e295cfbf 100644 --- a/src/utils/IterableActionRunner.ts +++ b/src/utils/IterableActionRunner.ts @@ -36,7 +36,8 @@ class IterableActionRunnerImpl { } } - window.open(uri, '_blank'); + const target = IterableConfig.openLinksInNewTab ? '_blank' : '_self'; + window.open(uri, target); return true; } diff --git a/src/utils/IterableConfig.ts b/src/utils/IterableConfig.ts index 70185a51..dde3b85b 100644 --- a/src/utils/IterableConfig.ts +++ b/src/utils/IterableConfig.ts @@ -4,4 +4,12 @@ export class IterableConfig { public static urlHandler: IterableUrlHandler | null = null; public static customActionHandler: IterableCustomActionHandler | null = null; + + /** + * Controls whether URLs opened by the SDK (e.g. from embedded message + * buttons) are opened in a new tab (`_blank`) or in the same tab (`_self`). + * + * Defaults to `true` (new tab / `_blank`) for backward compatibility. + */ + public static openLinksInNewTab = true; }