From 867ba85049e1a1315c5b25bfadabac2e6c775cbc Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] hide iframe before first meta event --- src/replay/index.ts | 3 +++ typings/replay/smoothscroll.d.ts | 1 + 2 files changed, 4 insertions(+) create mode 100644 typings/replay/smoothscroll.d.ts diff --git a/src/replay/index.ts b/src/replay/index.ts index 79e6c8e2..e72aab82 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -296,6 +296,8 @@ export class Replayer { if (this.config.UNSAFE_replayCanvas) { attributes.push('allow-scripts'); } + // hide iframe before first meta event + this.iframe.style.display = 'none'; this.iframe.setAttribute('sandbox', attributes.join(' ')); this.disableInteract(); this.wrapper.appendChild(this.iframe); @@ -308,6 +310,7 @@ export class Replayer { } private handleResize(dimension: viewportResizeDimention) { + this.iframe.style.display = 'inherit'; this.iframe.setAttribute('width', String(dimension.width)); this.iframe.setAttribute('height', String(dimension.height)); } diff --git a/typings/replay/smoothscroll.d.ts b/typings/replay/smoothscroll.d.ts new file mode 100644 index 00000000..562e3df1 --- /dev/null +++ b/typings/replay/smoothscroll.d.ts @@ -0,0 +1 @@ +export declare function polyfill(w?: Window, d?: Document): void;