This is a file stored locally, not on a server, so Server Side Includes do not work.
Problem:
I have an HTML file. There is lots of data in it, I want to split it into smaller parts, and then just include them all into my big html file, i.e. something like:
main.html
<include "partA.html">
<include "partB.html">
<include "partC.html">
And I want the result as if the contents of partA,B,C.html were read right into main.html
Now, this is not on a server — it’s stored locally, so I can’t do SSI. My question is:
Is there some simple way to do this via JavaScript? It seems like with JavaScript, I shoudl be able to:
- fetch the contents of blah.html [not sure how to do this ste[
- call a document.write on it, to write it into the document
- probably handle some stuff dealing with escaping strings
Question:
How do I do this?
Thanks!
It’s not possible, as a security feature. This post here is a discussion on the topic – Includes without local server?. As the answers say, your best best is to install a small web server on the machine if you can. They’re not too hard to get going.
I have used nginx before with good results. http://en.wikipedia.org/wiki/Nginx