Live data from Hacker News

Why can't HTML alone do includes?

frontendmasters.com

31–40 of 367 posts

Re: Why can't HTML alone do includes?

#31
post #5

FTA > We’ve got , which technically is a pure HTML solution, but And then on the following paragraph.. > But none of the solutions is HTML > None of these are a straightforward HTML tag Not sure what the point is. Maybe just complaining

is different from what the author is asking for, it has its own DOM and etc. He wants something like an SSI but client side. He explains some of the problems right after the part you cut off above

"We’ve got , which technically is a pure HTML solution, but they are bad for overall performance, accessibility, and generally extremely awkward here"

Re: Why can't HTML alone do includes?

#32
post #16

My guess: no-one needs it. Originally, iframe were the solution, like the posts mentions. By the time iframes became unfashionable, nobody was writing HTML with their bare hands anymore. Since then, people use a myriad of other tools and, as also mentioned, they all have a way to fix this. So the only group who would benefit from a better iframe is the group of people who don't use any tools and write their HTML with…

No, originally frameset[0] and frame[1] were the solution to this problem. I remember building a website in the late 1990s with frameset. iframe came later, and basically allowed you to do frames without the frameset. Anyway, frameset is also the reason every browser's user agent starts with "Mozilla".

[0] https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

Re: Why can't HTML alone do includes?

#33
> We’ve got , which technically is a pure HTML solution, but they are bad for overall performance, accessibility, and generally extremely awkward here

What does this mean? This is a pure HTML solution, not just "technically" but in reality. (And before iframe there were frames and frameset). Just because the author doesn't like them don't make them non-existent.

Re: Why can't HTML alone do includes?

#34
"Includes" functionality is considered to be server-side, i.e. handled outside of the web browser. HTML is client-side, and really just a markup syntax, not a programming language.

As the article says, the problem is a solved one. The "includes" issue is how every web design student learns about PHP. In most CMSes, "includes" become "template partials" and are one of the first things explained in the documentation.

There really isn't any need to make includes available through just HTML. HTML is a presentation format and doesn't do anything interesting without CSS and JS anyway.

Re: Why can't HTML alone do includes?

#35
Isn't this what proper framesets (not iframes) were supposed to do a long time ago (HTML 4?). At least they autoexpanded just fine and the user could even adjust the size to their preference.

There was a lot of criticism for frames [1] but still they were successfully deployed for useful stuff like Java API documentation [2].

In my opinion the whole thing didn't stay mostly because of too little flexibility for designer: Framesets were probably well enough for useful information pages but didn't account for all the designers' needs with their bulky scrollbars and limited number of subspaces on the screen. Today it is too late to revive them because framesets as-is wouldn't probably work well on mobile...

[1] https://www.nngroup.com/articles/why-frames-suck-most-of-the...> - I love how much of it is not applicable anymore and all of these problems mentioned with frames are present in today's web in an even nastier way?

[2] https://www.eeng.dcu.ie/~ee553/ee402notes/html/figures/JavaD...>

Re: Why can't HTML alone do includes?

#36
post #17

This was the rabbit hole that I started down in the late 90s and still haven’t come out of. I was the webmaster of the Analog Science Fiction website and I was building tons of static pages, each with the same header and side bar. It drove me nuts. So I did some research and found out about Apache server side includes. Woo hoo! Keeping it DRY (before I knew DRY was a thing). Yeah, we’ve been solving this over and ove…

You can message the page dimensions to the parent. To do it x domain you can load the same url into the parent with the height in the #location hash. It won't refresh that way.

Re: Why can't HTML alone do includes?

#37

Initially HTML was less about the presentation layer and more about the "document" concept. Documents should be self-contained, outside of references to other documents.

I still think this is the best web. Either you are a collection of interlinked documents and forms (manual pages, wiki,...), or you are a full application (figma, gmail, google docs). But a lot of sites are trying to be both. And somes are trying to be one while they are the other type.

Re: Why can't HTML alone do includes?

#38
So, HTML did have includes and they fell out of favor.

The actual term include is an XML feature and it’s that feature the article is hoping for. HTML had an alternate approach that came into existence before XML. That approach was frames. Frames did much more than XML includes and so HTML never gained that feature. Frames lost favor due to misuse, security, accessibility, and variety of other concerns.

Re: Why can't HTML alone do includes?

#39
post #6

Iframes, while not perfect, are pretty close though...

Making iframes be the right size is super awkward. I might actually use them more if they were easy to get responsive. This post does link to a technique (new to me) to extract iframe contents:

I've come across this technique here [0] to try it on elements, but sizing is even more difficult there.

[0]: https://www.filamentgroup.com/lab/html-includes/

Re: Why can't HTML alone do includes?

#40
post #34

"Includes" functionality is considered to be server-side, i.e. handled outside of the web browser. HTML is client-side, and really just a markup syntax, not a programming language. As the article says, the problem is a solved one. The "includes" issue is how every web design student learns about PHP. In most CMSes, "includes" become "template partials" and are one of the first things explained in the documentation. T…

Agree with what you said, however, HTML is a document description language and not a presentation format. CSS is for presentation (assuming you meant styling).
Post reply on HN