Showcase project embedding an <iframe />
displayed in full height in host document.
<iframe />
is the way to go when embedding your website into any non third-party website with no configuration and while sandboxing style 馃帹and security 馃敀.
However, building a responsive iframe 馃捇馃摫is pretty tricky. Especially displaying the iframe
in full height in the host document.
- The
<iframe />
window calculates its height 馃搹 and sends a message 馃摣(with a specific syntax) to its parent using thepostMessage
API. - The parent has a listener 馃憘to this message 馃摤 and dynamically sets the height of the
<iframe />
This project is hosted on CodeSandbox.
This project is inspired 馃挕& "forked" 馃尡from the Making IFrames Responsive article from bitsofcode and the related source code.