Download two files with one link






















To handle the looping part, we use setTimeout , which is necessary for it to work in IE. Update : I am aware that the "run code snippet" no longer works, but that's due to cross site cookie issues. The code works fine if deployed on your own site. I suppose you could initiate multiple file downloads using a bunch of iframes or popups, but from a usability standpoint, a ZIP file is still better. Who wants to click through ten "Save As" dialogs that the browser will bring up? I agree that a zip file is a neater solution But if you have to push multiple file, here's the solution I came up with.

Chrome will display a message to user to obtain his agreement to download multiple files the first time your site use it. The only side effect of this technique, is that user will see a delay between submit and the download dialog showing. To minimize this effect, I suggest you use the technique describe here and on this question Detect when browser receives file download that consist of setting a cookie with your file to know it has started download.

You will have to check for this cookie on client side and to send it on server side. Don't forget to set the proper path for your cookie or you might not see it. You will also have to adapt the solution for multiple file download. The browsers seem to have issues when you try to do it too fast So I used a timeout. To solve this, I created a JS library to stream multiple files directly into a zip on the client-side.

The main unique feature is that it has no size limits from memory everything is streamed nor zip format it uses zip64 if the contents are more than 4GB. Find "downzip" it on npm or github!

Thus community wiki. I am looking for a solution to do this, but unzipping the files in javascript was not as clean as I liked. I decided to encapsulate the files into a single SVG file. Edit: The SVG worked very well. If you are only going to download the files, ZIP might be better. If you are going to display the files, then SVG seems superior. When using Ajax components it is possible to start multiple downloads. Create an AjaxButton and override onSubmit. Create an AbstractAjaxTimerBehavior and start downloading.

Getting list of url with ajax call and then use jquery plugin to download multiple files parallel. Here is the way I do that. Like this:. How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.

Download multiple files with a single action Ask Question. As indicated, you can draw a rectangle around the links you want to select. This will highlight the links in yellow. If you need to scroll down or simply want to get rid of the pop-up box, you can hold down the H key. The downloads also appear on the bottom of the browser window. Unfortunately, this cannot be changed when using the extension.

Note that not all links may download files as expected. The link would need to be a direct file source, not a link to another page, otherwise the download might just be the HTML of that page and not the file itself. You can assign a shortcut key for activating this add-on. To do this, right-click on the uSelect icon again and select Options. Enter the shortcut keys you want to use. There can be multiple scenarios like this, say downloading e-books or study content and images from your library website, downloading music or MP3 files from a websites, or downloading any other kind of files like images, videos, free softwares etc.

It is usually a time consuming and lengthy process to do it one by one and does take lots of patience. The click event is sent to an element when the mouse pointer is over the element, and the mouse button is pressed and released. But we need to fire the native click exactly on links, so the only way to do this is to get the DOM node and invoke the native click method look at the row 7.

After the call we can remove the link that is unuseful anymore row 8. So we cannot avoid the browser reflow. Multiple files download on single link click Sometimes happens that some people need to download multiple file from a single user interaction: the click on the link. The basis The concept behind to our script is that we have a link on the page that should react with the download of multiple files.



0コメント

  • 1000 / 1000