DEV Community

Discussion on: Include HTML-in-HTML: an iteration

Collapse
 
sirseanofloxley profile image
Sean Allin Newell

What's the diff with these and iframe? Maybe iframe's protections and lil box is helpful for some reason you're about to hit into...

Collapse
 
lionelrowe profile image
lionel-rowe • Edited

iframes are great for their use case — rendering a different, full HTML document inside a specified area on the page, sometimes with additional sandboxing. They're not for rendering partial document fragments in a non-sandboxed way. You couldn't use them to render a single table row, a full-screen overlay, or a part of an inline SVG, for example. You also couldn't have styles from them affect the parent page or vice-versa. But you could do all of those things with this include-html element.

BTW this article is more of a "here's a fun thing I made that you can try out and maybe find a use for", not a "definitely use this extremely useful and necessary thing in production for your critical application used by millions of users".