Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda