How to Access iframe from Parent Element – Best Methods? or What's the Proper Way to Access iframe fr

18 Replies, 1165 Views

If you're desperate and it's cross-origin, you *could* try a proxy server to fetch the iframe content, but that's a whole other can of worms.

For same-origin, just make sure the iframe is loaded before you try to access it.

```js
iframe.onload = () => {
console.log(iframe.contentWindow.document);
};
```

But yeah, cross-origin = dead end.

Messages In This Thread



Users browsing this thread: 1 Guest(s)