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

365
Visualizações
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 à 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