How do I make a download system for simple exe files

I have a game that I want downloaded when a button is clicked. I've done this using the download attribute for images. How would I do it for exe files, this is a very small game I'm talking about.
22 Replies
dys 🐙
dys 🐙4d ago
Anchor (a) tags have a download attribute.
Jochem
Jochem4d ago
You also don't need a download tag for files the browser doesn't support anyway
ZNP
ZNPOP4d ago
I get that, for images, but how do I get them to download a zip file, etc
Jochem
Jochem4d ago
<a href="path/to/file.zip">Click to download</a>
<a href="path/to/file.zip">Click to download</a>
from mdn:
The HTMLAnchorElement.download property is a string indicating that the linked resource is intended to be downloaded rather than displayed in the browser.
meaning it's only necessary if it can be displayed in the browser. Zip and exe files cannot be displayed in the browser, so it's not necessary to add the download attribute to links to them.
ZNP
ZNPOP4d ago
okay, so the download attribute fits using a link for the zip file. Where would I store the zip file?
Jochem
Jochem4d ago
somewhere accessible to your webserver same place as your HTML works just fine, or a /downloads subfolder
ZNP
ZNPOP4d ago
I was thinking a Dropbox link might work
Jochem
Jochem4d ago
You legitimately do not need the download attribute unless it's a filetype that can be displayed in the browser. PDF, JPG, PNG, all would need a download attribute to download the file rather than show it in the browser. You do not need the download attribute for a file that cannot be displayed in the browser have you tried that at all? it depends on the way dropbox works, but it could in theory
ZNP
ZNPOP4d ago
No not yet, that's why I was gonna tinker with it today, as the Google drive method has been stopped by Google I'm confused are you saying I should or shouldn't use the download attribute for a zip file I'm sorry if I'm asking too many questions btw
Jochem
Jochem4d ago
you don't have to
ZNP
ZNPOP4d ago
then how would I get a download button? how would I get the zip file downloaded
Jochem
Jochem4d ago
like this if you link to a file the browser cannot display, it will offer to download it
ZNP
ZNPOP4d ago
ohhhhh thank you so much
ἔρως
ἔρως4d ago
instead of offering the entire exe file, offer an installer that downloads the needed files to the location the game will be installed in then, you can use any storage you want, including google drive it's a good idea to use an online store instead, like steam if you want, even use gog or epic store or some other this way, you skirt around the exe download by just pointing to the online stores those have their own "seo" and pages to customize too and show a lot more legitimacy than downloading a random exe from google drive, like how viruses are passed around and you dont have to worry the use of bandwidth in your site someone put a 3mb music file on a website, and was sent a bill of over 100k dollars because of illegitinate users just downloading the living crap out of it oh, itch.io is a good place for your game too and is less restrictive than the other stores this is not the answer you want, but the answer you need
ZNP
ZNPOP4d ago
what about a zip file? I'm just helping someone get their customers to download their game; so I thought it would be a good to have the zip in my public file with an anchor tag with a download link they used to use itch.io and don't want to anymore
ἔρως
ἔρως4d ago
that sounds sketchy beyond measure
ZNP
ZNPOP4d ago
I love your honesty 😭
ἔρως
ἔρως4d ago
but if it is for a single person, shoving on any storage service should be enough why wouldn't i be honest? but seriously, if i went to download a game and it came in a zip file, i would stop the download and avoid the website forever many viruses are distributed pretending to be a game, and then you download the zip file and you're screwed
dys 🐙
dys 🐙4d ago
¿As opposed to an executable? The browser is likely to flag any of these formats as unsafe and require an override to download. Really, your best bet would be to offer the software through some organization (like Steam or the Google Play Store) that vets software to try and help people avoid maliciousness. It'd definitely make people feel safer.
ἔρως
ἔρως4d ago
that's what i suggested also, some games offer a download to then download the files, instead of a huge exe
dys 🐙
dys 🐙3d ago
There are some "single" files that are a little blob of shell script prepended to an archive of source files. The sh script uncompresses it's own tailend after a user has agreed to a license or some other pre-install procedure. It's also a characteristic of many worms & viruses which automatically attempt to infect other machines in the same network. Many exploits have a side effect of shutting down the program you're attacking because you corrupt its memory space or something like that. It means that the attacker has to transmit all the code necessary to complete the attack in one go, because the service won't be around anymore after the attack. (Until someone one notices it has died and reenables it.)
ἔρως
ἔρως2d ago
i know, and there are lots of smaller viruses too but now-a-days, the meta is to make the virus about 600-700mb in size, so antiviruses skip checking the file

Did you find this page helpful?