I have searched for various ways to inject simple html into a .html file from an external source that does not require server side activity. I have found some answers, but none of them seem to be "proper" or best practice. Consider this scenario. Let's say we're building a 20 page website. I want the footer to appear on all pages and be the same on all 20 pages. This is a static, generic HTML website. I would like to put the
<footer>
<whatever></whatever> <!-- Yes, I know whatever is not a valid tag. Just for demo. -->
</footer>
markup in say a footer.html (or whatever ext.) so that I can just add it to the bottom of the pages. Then when I need to make changes, I only have to change a single footer.html (or whatever...) file.
This is simple enough using jquery.
$('whatever').html('content');
Which works... but requires loading jquery. Not usually a problem if we're using Bootstrap or Foundation since they require it any ways and you can locally run the js and css files needed for both.
We can try this one...
<object name="whatever" type="text/html" data="whatever.html"></object>
And that kind of works. You have to add the stylesheet to the whatever.html file so that is not efficient.
document.write
Is a dead horse.
And just to be clear, let's pretend that putting this on a server is just not a possibility.
Does anybody out there have a solution for something simple like this that would be effective?
Thanks in advance to any suggestions!