In my opinion the best solution uses jQuery:
a.html:
b.html:
This is my include file
This method is a simple and clean solution to my problem.
The jQuery .load() documentation is here.
Expanding lolo’s answer from above, here is a little more automation if you have to include a lot of files. Use this JS code:
$(function () {
var includes = $(‘[data-include]’)
$.each(includes, function () {
var file = ‘views/’ + $(this).data(‘include’) + ‘.html’
$(this).load(file)
})
})
And then to include something in the html:
Which would include the file views/header.html and views/footer.html.