I have written a function to download a file on click of a button in a popup. This is the HTML of the popup:
'<div class="modalpopup not-you-popup">' +
          '<div class="dialog-header header-red">' +
          '<h4><b style="color:red">Success</b></h4>' +
          '</div>' +
          'The file has been uploaded successfully<br>' +
          '*Please note that your file will take up to 7 days to process.'+
          '<table>' +
          '<tr><td>Total records</td><td> : </td><td><b>' + totalCount + '</b></td>' +
          '<tr><td>Uploaded records</td><td> : </td><td><b>' + res.successCount + '</b></td>' +
          '<tr><td>Error records</td><td> : </td><td><b>' + res.errorCount + '</b></td>' +
          '</table>' +
          '</div>'+
          (res.errorCount > 0 ? 'Please <a href="javascript:void(0)" (click)="getErrorFile(res.errorRecords)">Click here</a> to download the records with error' : '');
If I click on the link, it asks open xdg-open? instead of downloading the file. 
In console it also gives warning: sanitizing unsafe URL value javascript:void(0)