DEV Community

Discussion on: How would you go about detecting the height of content within an iframe?

Collapse
 
alohci profile image
Nicholas Stimpson • Edited

Again, the problem needs defining. I don't believe a perfect solution is possible. To get the size of the iframe's content, an initial height of the iframe must be set. Which means that the content's height can be affected via the vh unit and media queries. There's an unresolvable circular dependency there.

So you're looking for a solution which is "good enough" for your scenario. In which case, any of the proposed solutions might do. But if you can identify why a particular solution doesn't work for you, it might be possible to point you to a better one for your scenario.