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

99
Visualizações
Another way to display content from external file in html

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.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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">
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