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

139
Views
Is there any way to make this download button to work using https link?

I am trying to download something from another website, I have tried this but didn't work. Please I need a help here

<a href="https://www.samanthaming.com/logo.png" class="text-1 text-uppercase" download> download here</a>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

At first, make sure the download link is valid. Now You can make a custom javascript function to force download from an external link.

<script>
    function downloadForce(link){
        var url = link.getAttribute("data-href");
        var fileName = link.getAttribute("download");
        link.innerText = "Downloading...";
        var xhr = new XMLHttpRequest();
        xhr.open("GET", url, true);
        xhr.responseType = "blob";
        xhr.onload = function(){
            var urlCreator = window.URL || window.webkitURL;
            var imageUrl = urlCreator.createObjectURL(this.response);
            var tag = document.createElement('a');
            tag.href = imageUrl;
            tag.download = fileName;
            document.body.appendChild(tag);
            tag.click();
            document.body.removeChild(tag);
            link.innerText="download here";
        }
        xhr.send();
    }
    </script>
     
    <a class="text-1 text-uppercase" href="#" data-href='https://i.imgur.com/U2KQsBD.jpeg' download="image.jpeg" onclick='downloadForce(this)'>download here</a>
about 4 years ago · Juan Pablo Isaza Report
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!