> <i>There are or course other ways of forcing file downloads, such as adding certain configuration to your .htaccess file, but I think server-side solutions to front-end problems should be avoided whenever possible.</i><p>I'd disagree with this being a "Front End" problem. You, serving the file, presumably have an idea what you want the user to do with the file. The .html page you propose editing is server side. The file being <i>served</i> is server side. The server configuration is server side. But most importantly, most browsers don't handle that attribute.<p>So I'd say what you want is the Content Disposition header, specifically, "Content Disposition: attachment". Set a header for the file type you want handled. But that's not enough on its own to cover most browsers in the wild.<p>Various browsers handle this header differently. Our CDN supports the following headers for files which <i>are</i> viewable directly in the browser. Using the appropriate header <i>will</i> prompt to Save As... even with a normal (left) click.<p>We recommend number 2 or number 8:<p><pre><code> 1. Content-Disposition: attachment
2. Content-Type: application/x-download
Content-Disposition: attachment
3. Content-Disposition: attachment
Content-Type: application/force-download
4. Pragma: no-cache
Expires: 0
Content-Type: application/force-download
Content-Transfer-Encoding: binary
5. Pragma: private
Cache-control: private, must-revalidate
Content-type: application/x-download
Content-Disposition: attachment
6. Content-Encoding: AuraganDownload
Content-Disposition: attachment
7. Pragma: public
Cache-Control: must-revalidate, post-check=0, pre-check=0
Content-Disposition: attachment
8. Content-type: application/octet-stream
Content-Disposition: attachment
</code></pre>
This list was gradually added to over the last 10 years. Besides number 2, our main recommendation, the others here are for various edge cases such as popular downloaders or varieties of corporate firewalls, proxy servers, and reverse proxy (edge) caches. I included them just in case you're battling one of those cases and want some other incantations to try.