DEV Community

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

Collapse
 
jnschrag profile image
Jacque Schrag • Edited

I cheat and let somebody else do all the hard work for me. ¯\(ツ)/¯ Highly recommend the iFrame Resizer library when dealing with iFrames of dynamic height. It works basically the way you've outlined, by setting the height of the iFrame itself once the content has loaded through a script that is included on the parent site. I've never had to adjust any of the default settings to get the library to work for my use case, and I use it across a wide variety of sites/in different contexts.