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; }