Javascript JQuery link to download a txt file
<p>Is there a way to 'force' the browser to download a file instead of opening that?</p>

<pre><code>&lt;a href="file.txt"&gt;Download this file&lt;/a&gt;
</code></pre>

<p>I've tried the method via js using the window.open("file.txt", "Download"); </p>

<p>but no success.</p>

<p>Thx.</p>

<p>Updating:</p>

<p>I've done a php file as follow;</p>

<pre><code>&lt;html&gt;
&lt;a href='dl.php?bid=3'&gt;

&lt;php&gt;
$sql="select barquivo from bibilioteca where bid=$_GET[bid]";
$row=mysql_fetch_assoc(mysql_query($sql));
header("Content-Disposition: attachment;filename=biblioteca/$row[barquivo]");
</code></pre>

<p>And it download a file "biblioteca_" with 0 bytes.</p>
