From f482109db3b5c4bdc43c3f4376b0b95d27fdb99d Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] Don't throw away information about the iframe src (#733) * Don't throw away information about the iframe src * contentDocument is the important one as to whether we are recording an iframe directly --- packages/rrweb-snapshot/src/snapshot.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/rrweb-snapshot/src/snapshot.ts b/packages/rrweb-snapshot/src/snapshot.ts index ef312841..0f58d375 100644 --- a/packages/rrweb-snapshot/src/snapshot.ts +++ b/packages/rrweb-snapshot/src/snapshot.ts @@ -509,7 +509,12 @@ function serializeNode( } // iframe if (tagName === 'iframe' && !keepIframeSrcFn(attributes.src as string)) { - delete attributes.src; + if (!(n as HTMLIFrameElement).contentDocument) { + // we can't record it directly as we can't see into it + // preserve the src attribute so a decision can be taken at replay time + attributes.rr_src = attributes.src; + } + delete attributes.src; // prevent auto loading } return { type: NodeType.Element,