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

201
Views
Is it possible to download a BLOB after the preview has been opened in a new tab?

I use the below code to download some binary data (a PDF document) and open result in a new tab:

$.ajax({
    url: this.downloadurl,
    xhrFields: {
        responseType: "blob"
    }
})
.done(blob => {
    var url = URL.createObjectURL(blob);

    //open blob in new tab
    window.open(url);
    
    //additionally, download the document
    var a = $("<a>", {
        href: url,
        download: this.filename,
    }).appendTo(document.body);
    a[0].click();
});

It also downloads the document automatically because I found out that it's not possible to download it using the download icon in the preview. Below is the PDF document preview in Chrome. If I click on the download icon:

enter image description here

It will show this :

enter image description here

Is there a way to prevent this? It looks like the URL can only be used once.

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!