Force download instead of streaming of mp3 file in FF - html

As the title says, I'd like to download a mp3-file instead of playing it in Firefox.
I do it like this:
<a href="http://test.com/path/to/my/file.mp3" download></html>
In all other browsers the file is downloaded, only Firefox starts playing the audio file instead of asking me if I would like to save it to my hard disk.

Write this
<a href="http://test.com/path/to/my/file.mp3" download></html> WRONG
should be
download

Tested 8/18, Firefox correctly handles a simple download attribute. The accepted and second-ranked answers are wrong, at least as of now.
So, simply,
<a href="http://test.com/path/to/my/file.mp3" download></a>
will work, and if you want to control what the file is downloaded as, you give download a value:
That is why Chrome (or any modern browser) will download it as "true.mp3" if you try to use download="true" instead of a simple download to force the file download.
Also, note that <a></html> in the question isn't valid, and could have possibly caused a problem at the time if that's not just a typo.

I used <a href="http://test.com/path/to/my/file.mp3" download >download</a>
If you use the download="true" inside the anchor This will result in the renaming of the file name to true.mp3 in chrome an firefox as mention above.

This is the correct way to force the download:
download
NB: it will work on Firefox only if the file is located on the same domain unfortunately, cf. https://bugzilla.mozilla.org/show_bug.cgi?id=874009

Related

How to Make a Direct download link of an embedded Video

I have a Souce URL of a .MP4 video
here is the URL: http://naruto.manga47.net/Naruto_Dub/040.MP4
to download this video we have to open the link and wait for it to load and then we will be able to
download it by right-clicking on it and saving it as a video.
the Question is That ** I want to get a Direct download link of this video. After pasting the Direct link in a browser it will start downloading the video without any second click**
please tell me if this is even possible.
-Thank You
You can use tag to do this. I suspect somewhere in your code you have an link to this address. Just put a download tag after it like this:
<a href="/download/Naruto_Dub/040.MP4" download>
or like this:
<a href="/download/Naruto_Dub/040.MP4" download="Naruto Video">
and then it will tell the browser to download the file in that link. For more in-depth info read here: https://www.w3schools.com/tags/att_a_download.asp
EDIT: Chrome 65+ and Firefox only support same-origin download links, due to security reasons. You would need to download the file yourself, and put it somewhere on your website and then link it to your own website.
So basically you have a direct link of a file on internet, That is this : http://naruto.manga47.net/Naruto_Dub/040.MP4
the easiest thing you can do is just add ?dl=1 at last in the link in order to download it.
Now the link will be :
http://naruto.manga47.net/Naruto_Dub/040.MP4?dl=1

How to download the audio file instead of streaming [duplicate]

As the title says, I'd like to download a mp3-file instead of playing it in Firefox.
I do it like this:
<a href="http://test.com/path/to/my/file.mp3" download></html>
In all other browsers the file is downloaded, only Firefox starts playing the audio file instead of asking me if I would like to save it to my hard disk.
Write this
<a href="http://test.com/path/to/my/file.mp3" download></html> WRONG
should be
download
Tested 8/18, Firefox correctly handles a simple download attribute. The accepted and second-ranked answers are wrong, at least as of now.
So, simply,
<a href="http://test.com/path/to/my/file.mp3" download></a>
will work, and if you want to control what the file is downloaded as, you give download a value:
That is why Chrome (or any modern browser) will download it as "true.mp3" if you try to use download="true" instead of a simple download to force the file download.
Also, note that <a></html> in the question isn't valid, and could have possibly caused a problem at the time if that's not just a typo.
I used <a href="http://test.com/path/to/my/file.mp3" download >download</a>
If you use the download="true" inside the anchor This will result in the renaming of the file name to true.mp3 in chrome an firefox as mention above.
This is the correct way to force the download:
download
NB: it will work on Firefox only if the file is located on the same domain unfortunately, cf. https://bugzilla.mozilla.org/show_bug.cgi?id=874009

How to make chrome download instead of try to display a file

I'm trying to access a document template (.dot) that's linked from a company portal, using chrome. When I click on the link, the browser shows me a bunch of garbage. Is there a setting to force chrome to download this type of file and open it in word?
Example of garbage:
For HTML5:
<a href='file.dot' download>Click here to download</a>
'Download' attribute documentation can be read at:
http://www.w3schools.com/tags/att_a_download.asp
Supported since chrome 14.0.
EDIT: However this is controlled by the site. As for client-side settings, i think only changing the .DOT extension to match Word files in Windows, and perhaps even that won't work if chrome uses its own list.
In any case, you can right-click and "Save file as...", but yes, it's annoying.

How to force chrome to download an url with custom filename

Tried this:
Download Your Foo
Chrome unfortunatelly completely ignores the download attribute.
What can I do? Ideally to make it cross-browser...
Thanks
Have you tested this on any other web browsers.
According to w3schools here, it is an HTML5 attribute and internet explorer and safari do not support it. So, if you are looking for cross-browser, this probably isn't the best solution.
Also the link you have composed is wrong, if you downloaded google.com it points to index.html(I checked) .
I tried <a href="http://www.google.com" download>Here</a> and opened it in the latest chrome and it downloaded index.html. So if you need google chrome compatibility do a download attribute with "[your choice].html".
If you would like cross-browser compatibility I suggest you use php to change the headers then echo google's source. If you are unfamiliar with php go to
here

HTML5 download attribute not changing filename

I'm having issues with the download attribute and overwriting the filename. Currently when I set a value for the download attribute it is not taking affect. I believe this as something to do with the specific file I am referencing as it works for other files, but I'm not sure exactly what is causing the issue or how to resolve.
In the below code the filename does not get overridden. (I stole the code straight from W3Schools to keep the example very basic and to ensure nothing I am doing is creating the issue.)
Additional, the download only works in Chrome. If you try in Firefox it opens the file to play the video (which is another issue that I need to resolve).
<a href="https://cameratag.com/videos/v-c1e97800-8f2b-0132-12e6-22000a8c0328/qvga/mp4.mp4" download="w3logo22">
<img border="0" src="/images/myw3schoolsimage.jpg" alt="W3Schools" width="104" height="142">
</a>
Resolved, I contacted the content provider and determined the issue is due to the fact the assets URLs are actually redirects to a signed URL on their CDN.