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

366
Vistas
directory of files in an iFrame: get url of file clicked

In an iFrame (same origin), I'm displaying a list of file-links, like this:

<iframe src="my_public_folder_of_files/"></iframe>

Then, in my javascript, I'm trying to listen for the click event on those links, so I can get the href/url of the chosen file, like this

window.frames[0].document.addEventListener('click', e => {
  e.preventDefault();
  console.log(e.target.href);
})

But I'm not getting any logging at all.

If I inspect the page, I can see the <a href="file_url"> elements there, but I can't seem to access them programatically.

How can I get the url of a link clicked within a iFrame that's displaying a same-origin directory?

about 4 years ago · Juan Pablo Isaza
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