HTML Includes Deprecated?

HTML Includes Deprecated?
0

#1

I see mentions from years and years ago online about HTML Includes but this very simple common-sensical functionality doesn’t work for me at all. Has it been deprecated? 'Cause asking Google with those terms, “HTML Includes Deprecated?,” hasn’t dredged up anything on the first SERP for me yet.

If it has indeed been deprecated, does anyone know why? It’s so useful and simple I can’t imagine why anyone would want to not support it any longer.

Thanks!


#2

https://www.w3schools.com/howto/howto_html_include.asp


#3

That was the closest thing I could find. But what did you want includes for? Includes is not a default html tag or anything. It’s a scripting thing.


#4

Yes, that’s one of 'em old mentions I’d noted but, as also noted, they don’t work and I can’t imagine why they would have been deprecated (evidently)!


#5

Well again, what do you want includes for? If it’s for HTML snippets, there are other libraries that handle that, like React.


#6

It never got into HTML in the first place, it was just a part of the first Web Components spec, was never agreed upon, has now been dropped, and only Chrome implemented it in it’s existing form.

Edit: XTHML could also have done this, and it would have been phenomenal, but it was never implemented.

Edit edit:

React is a JS library, it isn’t HTML


#7

Well, as I understand it, HTML includes is a way to include the contents of one HTML file in another – using HTML (and not JavaScript or PHP).

Like including CSS files, only it’s another HTML file. I’d use it for navigational bars in the heading, or footers, or whatever.

It’s not a big thing and I’m just curious why not – and why it doesn’t seem to work anymore.

Hope that makes sense!


#8

Ah, okay. That makes sense. Cuz i recall a few times seeing includes, but that was like sparse.


#9

They use the link element for stuff like that. The CSS and JS stuff anyways.


#10

Oh, is that so? Okay, that makes sense…though the stuff I’d read (again, stuff dated years ago) made it seem like it’s part of the “canon.”

Too bad! Such a simple commonsensical thing and they didn’t think it needs to be implemented in the standard.


#11

Yeah they dropped it from the spec and it’ll use JS modules instead, which seems to make almost zero sense but hey ho.


#12

Hey ho indeed. Sometimes, the makers of languages do weird stuff.


#13

Okay, thanks everyone, I guess it’s just one of those simple ideas too good to be true (i.e., adopted as standard)!


#14

Yeah, no web components stuff is properly viable (orset in stone), it’s a massive mess even now, nearly 10 years after they were mooted.

Like in the time it’s taken to get to a third version of a spec that’s not supported fully anywhere, and they’re still pushing changes and extra features , Facebook wrote their version of Web components and it’s massively successful


#15

Are they still rooted in php?


#16

Not in any way? It’s just browser APIs (html, CSS, JS), always has been


#17

Really, I thought they were built on php first.

But then as I write that, oh shit I forgot, php is backend whoops.


#18

Yeah, it’s funny how certain things can work out – reminds me of a conversation I once had with a fellow New Yorker who’s an immigrant from Lebanon about road repair work: in his country, he noted, things used to get bombed but would be repaired in weeks, whereas in NYC it took literally several years (in this one case we were both complaining about at the time) for half a city block of road to be repaired…


#19

Heh, I guess it’s for a similar reasons; there a standard noone can agree on and it falls within a few organisations’ jurisdiction, and they just end up arguing about it instead of someone just doing it (and that someone very possibly f***ing it up)


#20

Nah, all frontend. I just reviewed the first few chapters of a new book on web components, and it’s the first time I’ve played around with them for a few years: it was pretty magic having no framework, but components (without html imports) can’t be used without JS, and JS frameworks like React or Vue kinda work better, so I dunno whether there’s much benefit at the minute