From 10fc4a1e2f163202d3435c166e7bddafca59bf6a Mon Sep 17 00:00:00 2001 From: Joris Pannekeet Date: Thu, 2 May 2024 16:01:16 +0200 Subject: [PATCH] fix: prevent infinite reload in setlanguage interaction --- src/interactions/setLanguage.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/interactions/setLanguage.ts b/src/interactions/setLanguage.ts index ce119cb40..7158c8401 100644 --- a/src/interactions/setLanguage.ts +++ b/src/interactions/setLanguage.ts @@ -9,7 +9,12 @@ function setLanguage({ event }: { event: Event }): void { const BBLocaleIndex = currentCookies.indexOf(`BBLocale=${locale}`); const hasCookie = BBLocaleIndex > -1; if (!hasCookie) { - document.cookie = `BBLocale=${locale};path=/`; + // check if app is used in an iFrame + if (window.location !== window.parent.location) { + document.cookie = `BBLocale=${locale};path=/;SameSite=None;Secure`; + } else { + document.cookie = `BBLocale=${locale};path=/`; + } window.location.reload(); } }