Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

91
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda