HTML/HTTP considered harmful
It's astounding that the web standards are so successful. When I have to deal with them I'm surprised how lame they are now and again.
Let's look at just one fundamental problem of HTML here: its lack of mechanisms to compose a document from multiple parts.
People always had the need to compose a web page out of multiple elements: take this piece of content here and put it into a web page.
An example would be the navigation bar. An element that is the same on every page of a web site. Even though virtually every web site in existence has a navigation bar, HTML won't let you express this.
No "INCLUDE" tag out there.
It is not possible to do with HTML.
The HTML standard has various contortions around this problem but it does not offer a simple, generic solution to this basic, trivial problem.
Frames, iframes, objects: they split a web page into multiple parts that basically behave like their own sub-browsers. Click on a link in a frame and the frame will be replaced by the target web page. But we do not want to include a whole page within its own sub-browser: we just want some bits of HTML.
There are hacks around the linking problem at least for the frame case, but frames are on the way out from the HTML standard, so even that ugly crutch will get lost on us once Google completely controls our view of the internet through "our" smartphones and will be able to "evolve" web standards on a whim.
Web Components: require you to write and execute code, see previous point.
CSS: it's possible to style elements so as to always include the same content. So the web hipsters whine all day long about how people are mixing "content" and "presentation" and then people should start polluting their presentation definitions with content?
Server-side computation: a fundamentally wise principle of the internet is: "the edge of the network should be intelligent [and do as much of the work as possible] and not the network". In spite of this HTML people are suggesting to do the composition of HTML documents on the server side. It's always the same document, so why requiring the network nodes (the servers) to do work/rendering/composition of the document on their side?! Why requiring the client to fetch the same piece of HTML over the net over and over again?
There are various lame exuses for not having an "INCLUDE" tag in HTML:
the browser "doesn't know how much space that element will use" (because possibly it might not be loaded yet, being an external resource), but HTML has had the IMG tag from day one which has exactly this characteristic and the world hasn't ended yet.
external resources could be nested - that is refer to further external resources, possibly ad infinitum. Limiting nesting depth would be a way around this..
you could be loading external resources that might break your security. Yes you could. That could be forbidden, couldn't it?
Tomáš Pospíšek, 2018-08-25