Skip to content

Conversation

@malaref
Copy link
Collaborator

@malaref malaref commented Apr 29, 2025

No description provided.

const iframes = document.querySelectorAll("iframe");
for (let i = 0; i < iframes.length; i++) {
const iframe = iframes[i];
if (iframe.contentDocument) {
Copy link
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

@nairmanu nairmanu self-requested a review April 30, 2025 23:57
for (let i = 0; i < iframes.length; i++) {
const iframe = iframes[i];
if (iframe.contentDocument) {
getId(iframe.contentDocument.documentElement); // Pre-discover ID for iframe root
Copy link
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?

Copy link
Collaborator

@nairmanu nairmanu left a comment

Choose a reason for hiding this comment

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

pls check for potential errors esp in safari when accessing iframe.contentDocument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants