1

I am new at web developing, I was trying to create download link for a file. This is the code:

<a href="http://symphonyrecords.ir/ARTISTS/Sasan-Khan-Namoondi/SasanKhan-Namoondi[320].mp3" target="_blank" download="SasanKhan-Namoondi[320]">           
<button class="downBtn1">Download</button></a>

But when I click the link the file starts downloading inside the browsers not in IDM. (I have tested other links from websites and there was no problem). Should I do something in the meta tag or something ?

Alex
  • 8,461
  • 6
  • 37
  • 49
Mehran
  • 481
  • 1
  • 9
  • 26

4 Answers4

1

After one day research and strangling i found the answer ... I just add onclick method and put the file link with www inside windows.open like this :

<a onclick="window.open ('http://www.symphonyrecords.ir/ARTISTS/Sasan-Khan-Namoondi/SasanKhan-Namoondi[320].mp3', ''); return false" href="javascript:void(0);" download>            
 <button class="downBtn1">Download</button></a>

This is not the best answer but it will do the job

Mehran
  • 481
  • 1
  • 9
  • 26
0

What is the server side language you have?

You need to set the below header from the server response,

Content-Disposition: attachment; filename=SasanKhan-Namoondi[320].mp3;

On the other hand, you can do the same at web server level. For an instance, if you use Apache, you can do this with .htaccess file

<IfModule mod_headers.c>
    <FilesMatch "\.(mp3|MP3)$">
        ForceType audio/mpeg
        Header set Content-Disposition "attachment"
        Allow from all
    </FilesMatch>
</IfModule>

Also, you have to enable headers module to make this works,

Make sure the below is checked

Apache -> Apache Modules -> headers_module

Aruna
  • 448
  • 3
  • 12
0
<a href="http://example.com/files/myfile.pdf" target="_blank">Download</a>

You can try this link:-How can I create download link in html?

Community
  • 1
  • 1
Razia sultana
  • 2,168
  • 3
  • 15
  • 20
0

Your code looks totally fine so it's certainly something with your browser or the download manager. Have you tried it with another download manager?

Maybe you can give this one a try.