1 bookmark for 2025-09-02

144.

HTML Includes That Work Today | Filament Group, Inc., Boston, MA

www.filamentgroup.com/lab/html-includes

To load and embed the SVG file, I used the following markup:

<iframe src="signal.svg" onload="this.before((this.contentDocument.body || this.contentDocument).children[0]);this.remove()"></iframe>

Despite the fact that this markup starts out as an iframe, if you inspect the graphic above using developer tools, you’ll see the SVG markup for the icon, inlined right in the HTML DOM, with no iframe element to be found. This is because the code uses an iframe to load the file, and an onload event to inject the iframe’s content just before the iframe in the HTML, before deleting the iframe itself.