[Common code 12] window.open to open multiple new windows is disabled solution, window.open(url) download multiple files can only download one solution

for loop this is useless

window.open('/admin/Download/downlads?id=' + this.idList, '_blank') // open external links in a new window

The browser will prompt whether to allow, you must click Allow to download multiple files

The code is pasted below

// 批量下载文件,类似window.open
var count = 0;
for (var i = 0; i < this.idList.length; i++) {
    
    
	var hiddenIFrameID = 'hiddenDownloader' + count++;
	var iframe = document.createElement('iframe');
	iframe.id = hiddenIFrameID;
	iframe.style.display = 'none';
	document.body.appendChild(iframe);
	iframe.src = '/admin/Download/downlads?id=' + this.idList[i]; //直接下载,不会弹出新的页面
}

Guess you like

Origin blog.csdn.net/qq_51055690/article/details/129562475