简体   繁体   English

从JavaScript控制台获取jQuery:下载所有文件

[英]jQuery from JavaScript console: download all files

I am visiting a website hightail.com that someone sent me 200 of my wedding photos on. 我正在访问hightail.com网站,有人将我的200张婚礼照片发送给我。 You can click each link to download the photo. 您可以单击每个链接下载照片。 Or you can sign up for $x per month and install software to download them all (avoiding this). 或者,您可以每月注册$ x并安装软件以全部下载(避免这样做)。

I can download the first photo using Chrome, jQuery and the JavaScript console with: 我可以使用Chrome,jQuery和JavaScript控制台通过以下方式下载第一张照片:

$('.downloadFile').click()

But I need to get all the photos, with this command: 但是我需要使用以下命令获取所有照片:

$('.downloadFile').each(function(i, a){$(a).click()})

However this still only downloads the first file. 但是,这仍然仅下载第一个文件。

Please advise on how to correct this. 请提供有关纠正方法的建议。

解决方案: trigger不能与delay一起使用,必须使用JavaScript的setTimeout

$('.downloadFile').each(function(i, a){ setTimeout(function () { $(a).trigger('click') }, i*4000); })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM