从磁铁链接数组下载多个种子 [英] Download multiple torrents from array of magnet links

查看:55
本文介绍了从磁铁链接数组下载多个种子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用javascript遍历数组"magnet:.."链接,并迭代下载它们.

I'm trying to use javascript to iterate over an array of "magnet:.." links and download them iteratively.

我正在使用iframe通过这种方式下载链接:

I am using an iframe to download the link this way:

HTML代码:

<button ng-click="downloadSelected()">Get All Selected</button>
.
.
<iframe id='downloader_iframe'></iframe>

在控制器内部:

function downloadSelected(){
    for (var i=0; i<$scope.magnets.length; i++){
        document.getElementById('downloader_iframe').src = $scope.magnets[i];
    }
}

问题在于,仅对数组中的第一个链接执行操作,而其余的链接则被完全忽略.

The problem is that the action is happening only for the first link in the array while the rest of them ignored completely.

有什么办法吗?

推荐答案

使用 window.open .例如,在< a> 上单击

Make use of window.open or .click on an <a>, for example

function downloadSelected() {
    var i;
    for (i = 0; i < $scope.magnets.length; ++i) {
        window.open($scope.magnets[i], '_blank');
    }
}

这篇关于从磁铁链接数组下载多个种子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆