3 ms·
This has always worked for me. Pretty much the ask? https://gist.github.com/sreekotay/08f9dfcd7553abb8f1bb17375d601633 https://gist.github.com/sreekotay/08f9dfc
by sreekotay 1y ago
This has always worked for me. Pretty much the ask?
https://gist.github.com/sreekotay/08f9dfcd7553abb8f1bb17375d601633 https://gist.github.com/sreekotay/08f9dfcd7553abb8f1bb17375d...
- alecsm 1y agoBut you need a server for that to work.
- sreekotay 1y agoyou need a server for HTML to work, as practical matter. But yes. There IS a workaround to that too, if you're REALLY determined, but you have to format your HTML a giant JS comment block (lol really :)) [edit: I'm sure there are still some file:// workflows for docs - and yes this doesn't address that]
- CamouflagedKiwi 1y agoThat's the first thing listed in the article? "Javascript to go fetch the HTML and insert it". What they're after is something that's _just_ HTML and not another language.
- sreekotay 1y agoWhile you do need a server i think this is the functional equivalent? The fetch JS and insert outlined (linked to) in the article is async. This blocks execution like you'd expect an HTML include to do. It's WAY easier to reason about - which is why the initial ask, I think...
- j45 1y agoThe <object> tag appears to include/embed other html pages. An embedded HTML page: <object data="snippet.html" width="500" height="200"></object> https://www.w3schools.com/tags/tag_object.asp https://www.w3schools.com/tags/tag_object.asp
- sreekotay 1y agohunh - THAT's cool. Learn something new every day. That said - it does appear encapsulated, much like an iframe - css doesn't take, etc. so though more "pure" HTML I'd argue doesn't fulfill the spirit of "include"?