Javascript CSV file download issue in FireFox, works in Chrome
<p>I have some code which downloads some data into a csv file which works great on chrome but doesn't do anything on firefox (no errors)</p>

<p>Here is the code: </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;script&gt;

        var data = [
           ['idea', 'a very good one'],
           ['beer', 'not when driving'],
           ['guitar', 'yes please']
        ];


        function download_csv() {
            var csv = 'Name,Title\n';
            data.forEach(function(row) {
                    csv += row.join(',');
                    csv += "\n";
            });

            console.log(csv);
            var hiddenElement = document.createElement('a');
            hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv);
            hiddenElement.target = '_blank';
            hiddenElement.download = 'test.csv';
            hiddenElement.click();
        }

    &lt;/script&gt;

    &lt;button onclick="download_csv()"&gt;Download CSV&lt;/button&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Why is it not working in firefox?</p>