mardi 29 décembre 2020

Download SVG files

I want to download files using javascript which have svg extension. Actually I have around 300 svg urls which i want to download via code. I have tried with this code

function downloadURI(uri, name) {
  var link = document.createElement("a");
  link.download = name;
  link.href = uri;
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
  delete link;
}
downloadURI("https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/410.svg", "helloWorld.svg");

but by this a tab with the given url is getting opened, i want it to be downloaded.

Here is the example link i am trying to download Example Link




Aucun commentaire:

Enregistrer un commentaire