Man, this is such a common headache. For same-origin, `contentWindow` *should* work, but timing is everything. If the iframe isn't loaded, you'll get `null`.
Try this:
```js
const iframe = document.getElementById('your-iframe');
iframe.onload = function() {
const innerDoc = iframe.contentDocument || iframe.contentWindow.document;
console.log(innerDoc.body);
};
```
Cross-origin? Forget it. Security rules are strict for a reason.
Try this:
```js
const iframe = document.getElementById('your-iframe');
iframe.onload = function() {
const innerDoc = iframe.contentDocument || iframe.contentWindow.document;
console.log(innerDoc.body);
};
```
Cross-origin? Forget it. Security rules are strict for a reason.
