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

312
Vistas
Detect file download event of a file link in JavaScript

Basically, I have different files stored on a server and I want to show/view the files in an iframe using their links. If a file is an image, it works as intended showing the image, but other files like .doc or .pptx gets downloaded instead. How can I detect that download event so that I can prevent it and show a 'No preview available' warning?

Here's the part where I display the files. I don't really know where to go from here.

<div id="file-container">
   <iframe src="/file/from/server.xyz" frameborder="0"></iframe>
</div>
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