<a id="downloadLink" href="http://samplepdf.com/sample.pdf">sample pdf</a>
<input type="button" onclick="download()" value="download" />
function download(){
link =document.createElement('a');
link.href=document.getElementById('downloadLink').href;
link.target='_blank';
link.click();
delete link;
}
All these steps can be avoided if somehow the download button can be removed.
then just the below code will do the magic. :)
<a id="downloadLink" target="_blank" href="http://samplepdf.com/sample.pdf">sample pdf</a>