只有当我从网站上下载文件时,所有其他链接都将下载target =“ _blank”野生动物园,而不是在新标签页中打开
{{some_URL}}
startFileDownloadUsingBlob(blob: Blob, fileName: string, extension?: string) {
const link = this.renderer.createElement('a');
link.setAttribute('style', 'display: none');
let url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.download = extension ? fileName+'.'+extension:fileName;
document.body.appendChild(link);
link.click();
setTimeout(() => {
document.body.removeChild(link);
URL.revokeObjectURL(url);
}, 100);
}