我编写了一个函数,单击弹出窗口中的一个按钮即可下载文件。 这是弹出窗口的HTML:
'<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' : '');
如果我单击链接,它会询问打开xdg-打开?,而不是下载文件。
在控制台中,它还会发出警告:sanitizing unsafe URL value javascript:void(0)