Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/clarity-js/src/insight/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ export function start(): void {
doc.start();
getId(document.documentElement); // Pre-discover ID for page root
interaction.observe(document);

// observe other document nodes
const iframes = document.querySelectorAll("iframe");
for (let i = 0; i < iframes.length; i++) {
const iframe = iframes[i];
if (iframe.contentDocument) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can throw exception if iframe is cross origin so better to wrap it in try catch to avoid console errors

getId(iframe.contentDocument.documentElement); // Pre-discover ID for iframe root
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to call getId?

interaction.observe(iframe.contentDocument);
}
}
}

export function stop(): void {
Expand Down