News for hackers. Stuff that matters.
Re:Seeking an Answer: Why can't HTML alone do includes? by j45 on Saturday May 03, 2025 @08:37PM (#43883541)
Neat reference, going to look into that.

The <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

Re:Seeking an Answer: Why can't HTML alone do includes? by nephyrin on Sunday May 04, 2025 @12:52AM (#43884575)
<object> used like this is just a poor iframe in a much shakier spot in the standards, mostly for backwards compatibility.

Like iframe, it "includes" a full subdocument as a block element, which isn't quite what the OP is hinting at.

Re:Seeking an Answer: Why can't HTML alone do includes? by gpvos on Sunday May 04, 2025 @02:01AM (#43884835)
Sound like it's good enough for headers and footers, which is 80% of what people need.
Re:Seeking an Answer: Why can't HTML alone do includes? by masklinn on Sunday May 04, 2025 @02:29AM (#43884931)
That’s what lots of sites used to do in the late 90s and early aughts in order to have fixed elements.

It was really shit. Browser navigation cues disappear, minor errors will fuck up the entire thing by navigating fixed element frames instead of contents, design flexibility disappears (even as consistent styling requires more efforts), frames don’t content-size so will clip and show scroll bars all over, debugging is absolute ass, …

And it increases resource use.

Re:Seeking an Answer: Why can't HTML alone do includes? by j45 on Sunday May 04, 2025 @11:27AM (#43887259)
It’s not ideal, but t it does exist in pure html… and the OP didn’t seem to note it.

A bit of vanilla JavaScript with WebComponents is a few lines:

https://gomakethings.com/html-includes-with-web-components/

Re:Seeking an Answer: Why can't HTML alone do includes? by masklinn on Sunday May 04, 2025 @11:34AM (#43887297)
> it does exist in pure html [...] JavaScript with WebComponents

You seem to have a rather original definition of "pure HTML".

Re:Seeking an Answer: Why can't HTML alone do includes? by j45 on Sunday May 04, 2025 @12:41PM (#43887742)
Typo, from the numerous fat finger typos you see above. :)

An html only option that exists is using object. Replying to the miss of the OP in case others might find it suitable.

If a tiny bit of vanilla JavaScript can be tolerated, WebComponents appear to have a broad standardized approach that is not framework dependant.

Re:Seeking an Answer: Why can't HTML alone do includes? by j45 on Sunday May 04, 2025 @11:26AM (#43887254)
Whether it’s good enough or not it does exist and everyone can decide if it works for them.

I’d probably explore WebComponents, but wanting the height of JavaScript without JavaScript..

Re:Seeking an Answer: Why can't HTML alone do includes? by j45 on Sunday May 04, 2025 @11:24AM (#43887242)
It’s an option built into html.

The OP doesn’t need to hint.

Re:Seeking an Answer: Why can't HTML alone do includes? by jazzypants on Sunday May 04, 2025 @11:15AM (#43887199)
Yeah, that is just a crappier version of HTML Frames [1]

1 - https://en.m.wikipedia.org/wiki/Frame_(World_Wide_Web)

Re:Seeking an Answer: Why can't HTML alone do includes? by j45 on Sunday May 04, 2025 @11:20AM (#43887226)
I don’t disagree, the premise of the article seems to be unaware, it’s entirely possible to us html alone to do includes. :)

Some might argue react is over abstracted or over engineered to do the same.

Interpretation and preference is different than if it’s possible