I've made a website but the problem is when people is trying to download the file instead it opens the file not save as or download the file.
Asked
Active
Viewed 2,773 times
-2
-
3Possible duplicate of [How can I force download with html and/or javascript?](https://stackoverflow.com/questions/8613725/how-can-i-force-download-with-html-and-or-javascript) – JJJ Oct 28 '17 at 13:15
-
Doesn't a simple search on google offer you information about that? You need to send out a http header. You want to add information on _how_ to handle some object you send. So the information cannot be _part of_ that object. You need to add it to the protocol layer, so a header entry. – arkascha Oct 28 '17 at 13:37
1 Answers
0
use <a href="./assets/file.rar" download>Download file</a>

Martin Homola
- 255
- 1
- 12
-
-
But it open's the file instead of downloading it, if you wanna try Click This ravens-hangar.tk/repaints.html and try to download a file? Thanks – Raven Lescano Oct 29 '17 at 01:19
-
http://jsfiddle.net/adderrrr/d59x3Lgx/ I do not know, but it should work. – Martin Homola Oct 30 '17 at 06:32
-
I think the problem is the file type I'll be trying to change it from .rar to .zip – Raven Lescano Oct 30 '17 at 09:24