How to embed html in html?

How to embed html in html?
0

#1

I made a navbar for a site, and I don’t want to copy and paste it into a bunch of different pages, making updating it difficult and whatnot. I like DRY and feel like the elements which are similar should be done once, ran multiple times. I found a way using javascripts document.write and it worked on my PC but not when I uploaded it to the server, and I remember reading that document write is bad practice. How do I embed an html file in an html file?


#2

You use a different language that generates HTML (PHP for example, but almost every language has templating libraries that have this capability). HTML does not have the capability you want (it was mooted, but the spec changed and it wasn’t implemented outside of Chrome, and I think that’s been dropped completely now)