In the past I used the HTTP header
Content-Disposition to instruct the browser to download a file. I ended up doing this because I knew of no other way for this.
I discovered, that the
anchor-element has a
<a href="35567e83.pdf" download="report-2022.pdf"> Download Report </a>
By clicking this link, the browser will download the file instead of linking to it and saves it as
The browser support for this attribute is pretty good with support by all major desktop and mobile browsers.
More details can be found at the MDN docs.