Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

check iframe document state, not main document

Oleg Isonena5c61ee42f11
diff --git a/apps/designer/app/shared/dom-utils/on-iframe-load.ts b/apps/designer/app/shared/dom-utils/on-iframe-load.ts
index 766329bc54..c287171841 100644
--- a/apps/designer/app/shared/dom-utils/on-iframe-load.ts
+++ b/apps/designer/app/shared/dom-utils/on-iframe-load.ts
@@ -6,7 +6,8 @@ export const onLoad = (iframe: HTMLIFrameElement) =>
new Promise((resolve) => {
if (iframe === null) return;
const check = () => {
- if (document.readyState === "complete") {
+ const document = iframe.contentDocument || iframe.contentWindow?.document;
+ if (document?.readyState === "complete") {
clearInterval(intervalId);
resolve("complete");
}