I was wondering wether there is a way to include some html content inside another html using only html?
A replacement to PHP\'s
There's no such thing. You'd have to use a server-side scripting language or JavaScript to do something like this.
Almost 10 years later, some people may still have doubts about this. So I'm going to explain a simple solution that we have today in 2020.
I always use the jquery .load() function and never had a problem with that.
Exemple: ( "#content" ).load( "includes/menu.html" );
If you're using Apache, you can try Server Side Includes.
This might be a few years late but this is how i did it !
in the first line after put this line !
<SCRIPT LANGUAGE="JavaScript" src="http://yourdomain.com/header.js">
then create a file called "header.js" and enter the content of the file you want to include ! like so....
<!-- Begin
document.write('<center>');
document.write('<a href="http://alinktosomewhere.co.za">a link 1</a>');
document.write('<a href="http://alinktosomewhere.co.za">a link 1</a>');
document.write('<a href="http://alinktosomewhere.co.za">a link 1</a>');
document.write('<a href="http://alinktosomewhere.co.za">a link 1</a>');
document.write('<hr>');
document.write('</center>');
// End -->
Hope this help !
It cannot be done purely by HTML. (There are iframes, however, but I don't think that qualifies in this case.)
It can be done using JavaScript. You get the other file via Ajax, and place its contents inside an HTML element on the current page.
HTML does not have a feature to include additional content natively. However most web servers do have server-side include statements:
SSI in Apache
SSI in IIS