-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?

OPV
  • 1
  • 26
  • 81
  • 156
  • @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