Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
How to load an external html and it´s css files with XMLHttpRequest?

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();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try next

<object type="text/html" data="your-file.html" width="100%" height="100%" />

Maybe you need to assign "height: 100vh;" with extra css.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!