I want to load an html and it`s css files into other html with XMLHttpRequest() The problem is that the html file is loaded but not it´s css file.
it is possible to load the file so that it looks the same as the original?
I have achieved this by loading it into a full screen iframe but would like to achieve this without the use of an iframe.
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET", "myHtmlWithCss.html", true);
xmlhttp.send();
Try next
<object type="text/html" data="your-file.html" width="100%" height="100%" />
Maybe you need to assign "height: 100vh;" with extra css.