I am writing a script which shall download a pdf instead of showing it. I am using Firefox as a webbrowser (latest version) and I installed greasemonkey (latest version) and I am using the Ubuntu OS (14.04).
This is the function I wrote:
function downloadFile(finalURL){
// Create new (invisible) link:
var link = document.createElement('a');
link.href = finalURL;
link.download = 'test.pdf';
document.body.appendChild(link);
link.click();
}
However, the browser still shows the file instead of popping up the "Save as"-Dialogue.
I don't know what I am doing wrong...
Anyone who knows how to fix this?
Thanks in advance!