Ask OfflineW!
Because every question deserves an answer

Sponsored

Practica
MCQ Practice — Offline
Sharpen your skills with quick, offline-ready MCQ tests for instant revision and exam prep.
  • 500+ curated MCQs
  • Timed quizzes
  • Instant feedback
Start Practicing
No signup offlinew.com/practica

Related

  • Practice MCQ
  • Tutorials
How to set a header for a HTTP GET request, and trigger file download?
20:28 30 Jun 2014

Update 20140702:

  • The solution
  • Detailed answer as a blog post

(but I'm marking one of the other answers as accepted instead of my own, as it got me halfway there, and to reward the effort)


It appears that setting a HTTP request header is not possible through links with , and can only be done using XMLHttpRequest.

However, the URL linked to is a file that should be downloaded (browser should not navigate to its URL), and I am not sure is this can be done using AJAX.

Additionally, the file being returned is a binary file, and AJAX is not intended for that.

How would one go about triggering a file download with a HTTP request that has a custom header added to it?

edit: fix broken link

javascript ajax http-headers download

Your Answer

lock_outline

You need to log in to submit an answer.

Newsletter

Subscribe for updates

Advertisement

OffLine
Watch Videos — No Internet
Enjoy trending videos, watch offline anytime. Create, share & stay entertained — even when you’re offline.
  • Watch without internet connection
  • Create & share your videos
  • Fast, smooth & high-quality
Download Now
No signup needed offlinew.com
Terms Privacy Support
© 2025 OffLinew — All rights reserved

Privacy & Cookie Consent

We use cookies to ensure the best experience on our website. This includes analytics, personalization, and marketing purposes. Some cookies are essential for the website to function properly.

By clicking "Accept", you consent to our use of cookies. You can read more about how we use cookies and how you can change your preferences in our Privacy Policy.