Time to answer my own question. This is a really old question and it probably wasn’t possible at the time but lots has changed since then. The HTML5 spec added the download
attribute:
<a href="https://stackoverflow.com/questions/2110269/hugepdf.pdf" download>Download file</a>
This will do exactly what I need, tell the browser to download the file instead of opening it. Thanks to Jonathan Svärdén for solving my years old question!