Skip to content

Commit 3ae7427

Browse files
committed
Pass search params from host to embed
1 parent d0770da commit 3ae7427

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

apps/simulateurs/src/lib/iframe.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,16 @@ const createAkimeoEmbed: CreateAkimeoEmbed = function createAkimeoEmbed(
161161
},
162162
);
163163

164-
iframe.setAttribute("src", new URL(path, origin).toString());
164+
const currentUrl = new URL(window.location.href);
165+
const url = new URL(path, origin);
166+
167+
currentUrl.searchParams.forEach((value, key) => {
168+
if (!url.searchParams.has(key)) {
169+
url.searchParams.set(key, value);
170+
}
171+
});
172+
173+
iframe.setAttribute("src", url.toString());
165174

166175
container.appendChild(iframe);
167176
};

0 commit comments

Comments
 (0)