Hacker News new | ask | show | jobs
by TooCreative 2024 days ago
I doubt iframes can stretch to the content even with JS.

Maybe for special cases, where the content is from the same domain or is actively messaging the size outwards so you can code some interplay between the outer page and the iframe. But neither side can do it alone.

2 comments

There are projects such as iFrame Resizer [0] for this, and you're correct that it does require cooperation from the iframe source.

[0]: https://davidjbradshaw.github.io/iframe-resizer/

I'm on mobile and can't double check this right now, but couldn't you resize the frame until it no longer scrolls?