I have a html file with a UL element. I want to load the LI elements for this UL from an external file that will be in the same folder as the html file. The external file can be any type of file. So .html or .txt, xml maybe? (preferably not JS)
Methods i've tried that work but why I don't want to use them:
jQuery load Works ofcourse but I don't want to use external libraries for a relatively easy request.
XMLhttprequest It's going to be a local very simple tool for co-workers, and this also seems too big of a request for just 10 li's.
w3 Include Same as XMLHTTPrequest
document.write I'm using document.write right now as a solution, but then the external file is a .js file. I rather have my coworkers work in a HTML or txt file plus i read a lot of negative stuff about document.write. And this file starts with: document.write(' - and i rather have the file start with the li's like < li > 1 < / li >
iframe or object I don't like how these tags append a whole new html and body tag to the UL and also styling is an issue.
php also to big of a step for just a local web application.
File reader also tried letting the user upload a txt file in a filereader. But I don't want the upload option
I probably tried more than the above solutions. But I just can't wrap my head around that this can't be done more easily or lightweight if the file is in the same folder.
Looking for a simple / easy solution if possible.
Native implementation of HTML Imports will be removed from Chrome 73 so it is now recommended to use native fetch(), or third-party libraries.
DEPRECATED look at https://www.w3.org/TR/html-imports/
<link rel="import" href="myfile.html">