I have a problem to download multiple file without JavaScript. May I know is possible HTML download Attribute can download multiple file without using JavaScript?
Below is my coding:
<a href="https://cdn.sstatic.net/Img/teams/teams-illo-free-sidebar-promo.svg?v=47faa659a05e" download><button style="background-color:#ED1C24;color:white" >Article</button></a>
For example, if I want to download these https://cdn.sstatic.net/Img/teams/teams-illo-free-sidebar-promo.svg?v=47faa659a05e and https://dco-assets.everestads.net/iCornerStore/source-images/MICROSOFTSTORE/current/cc1b5d10e9ab7ea9c03e62e1cc6172b6.png. I try to modify like below the code, but it doesn’t work.
<a href="https://cdn.sstatic.net/Img/teams/teams-illo-free-sidebar-promo.svg?v=47faa659a05e,https://dco-assets.everestads.net/iCornerStore/source-images/MICROSOFTSTORE/current/cc1b5d10e9ab7ea9c03e62e1cc6172b6.png" download><button style="background-color:#ED1C24;color:white" >Article</button></a>
Hope someone can guide me on how to solve this problem. Thanks.
*Note: Why I don’t using Javascript because I am doing in Magento 1.7 version to add download multiple image function.
2
Answers
Short answer. What you want is not possible with an single HTML link only.
I can think of the following alternative possibilities without Javascript:
If you can’t target a zip file, then only with multiple links.
UPDATE (JS Version)
With pure JS it can look like this:
The best way to do this is to have your files zipped and link to that.
Which states the following:
HTML:
JS:
Having said this, I would still go with zipping the file, as this implementation requires JavaScript and can also sometimes be blocked as popups.
Option 2 is to have multiple link to the download button.
HTML:
JS:
Minimized Code for multiple links in one button: