Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!