How do I make a button download a file when you click it?

How do I?

this is the kind of thing you should search online for.

this site might help, i don’t know. @Jovanny and @pumpkinhead might also be able to help.

and as a side note:

do not do this please. someone will come eventually.

In my case I don’t know… I’m just answering, because I got tagged, but @BSA_15, it is preferred not to reply rather than reply IDK like I just did. Hopefully what @awc95014 sent you solves your problem.

well here’s how for text files:

var blob = new Blob([textContents], {type: "text/plain"});
var url = URL.createObjectURL(blob); // Create URL for the file

// Create a URL leading to the download
var link = document.createElement("a");
link.href = url;
link.download = "filename.txt";

// Click the link to start download
link.click();
1 Like