dynamically add a tag and set the download attribute to download, which is useful in chorme (33 and 59 I tried), but useful in version 65.
simplifies the code as follows:
<body>
<a href="1.txt" download id="down">123</a>
</body>
<script>
for (var i = 0; i < 3; PPi) {
// setTimeout(function () {
document.getElementById("down").click();
// }, 100 * i);
}
</script>
this code only downloads one under 65, and prompts whether multiple downloads are allowed under 33 and 59.
Open the comments, and you can download 3 of them normally at 65, but there is no prompt to allow multiple downloads.
after testing, the size of the delay has nothing to do with the size of the downloaded file
seems to have something to do with cpu.
after the for loop, you can only download one of the following code on 65.
var now = +new Date();
while(1) {
if (+new Date() - now >= 1000) {
break;
}
}
I would like to ask, what is the reason for this, or is there a better way to deal with it?