I want to include a snipped of HTML in multiple pages (each with a different development worflow & framework). In order to avoid having to update each page when that snipped changes, each page is loading a Javascript file that currently looks like this
var html = "lots of html with <style> and <script> tags";
var wrapper = document.createElement("div");
wrapper.innerHTML = html;
document.querySelector('body').appendChild(wrapper);
I'm looking for a better solution to inject HTML-content from another source using Javascript.
Try this: