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

192
Vistas
Is there a way to (re-save) an image (that already exists locally) with javascript, "without opening the image in the tab"?

I have an anchor tag that refers to an image that already exists on my local machine,

What I want is, when the user clicks on it, it downloads the image (and not open it in a tab)

The current behavior is, when I click on it, it opens the image in the browser in the same tab (or a new tab if target="_blank")

I understand that the file already exists, but I want to 're-save' it again.

I noticed the following behavior when I used this anchor tag:

<a title="title" href="localpath/image.jpg" download></a>

  • Firefox: downloads(save) the image correctly.
  • Edge: opens the image in the tab.
  • Chrome: sometimes behaves like Firefox and sometimes like Edge, (happens randomly on different machines).

I tried FileSaver.js but didn't work as I want.

I know that there has to be a server for the "download" attribute to work, but I guess there's something I'm missing.

Note: my html works on static files, it never fetches a server. and I updated my browsers to the latest versions, and cleared my cache and cookies :)

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