-6

There is a following code:

var a = document.createElement("a");
        a.href = url;
        a.download = fileName;
        document.body.appendChild(a);

What is property download, how does it work?

POV
  • 11,293
  • 34
  • 107
  • 201
  • @OPV That page also says: "*download only works for same-origin URLs, or the blob: and data: schemes.*". – Daedalus Dec 17 '19 at 08:23
  • The download attribute specifies that the target will be downloaded when a user clicks on the hyperlink. – Phani Dec 17 '19 at 08:24