Chrome单页面最大下载数量限制

今天帮助GF下载东奥会计在线的课件,发现Chrome竟然有单页面最大下载数量限制。

问题是这样发生的:

在东奥的会计下载页面(),有许多这样的内容

<a class="mp3 mr-10" href="/usercenter/fetch.html?id=18940&downType=mp3" target="_blank">mp3</a>

href的链接就是要下载的内容

于是简单写一个js脚本:

$("a.mp3").each(function (i) {
		if (typeof(window.open($(this).attr("href"))) != "undefined") {
			$("body").append(i + ", ");
		}
	});

结果发现,插入到页面中的一直是:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24

而下载到的文件也是只有25个。

最后没办法只能每次记录已经下载的链接,然后刷新页面重新下载其他的:

var a = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24];
$("body").append("var a = [");
$("a.mp3").each(function (j) {
		var i;
		for (i = 0; i < a.length; i++) {
			if (parseInt(j) == parseInt(a[i])) {
				if(j == 0)
					$("body").append(j);
				else
					$("body").append("," + j);
				return;
			}
		}
		if (typeof(window.open($(this).attr("href"))) != "undefined") {
			if(j == 0)
				$("body").append(j);
			else
				$("body").append("," + j);
		}
	});
$("body").append("];");


经验分享 程序员 微信小程序 职场和发展