I've setup a download link on the site I'm building so that when users sign up to the musicians mailing list they can download a track for free. With this current code:
click here to download
It works in Firefox when you click the link it opens a window asking if you'd like to download but in Chrome it streams the track. If I change the file to .ogg then the reverse happens - I can download in Chrome but it streams in Firefox. Guess this is happening because I'm providing a format that the browser is capable of streaming. So how do I stop it streaming? can I provide two href's?
Having looked for similar questions here I came across the html5 attribute which can be added to links download="filename.mp3" I've tried this:
click here to download
But still it keeps streaming in Chrome, any ideas? help please?
Can you zip the file? that'll avoid the streaming.
OTHER OPTION
Other option a little of PHP :
<?php
$file = $_GET['file'];
header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".$file.";");
header("Content-Length: ".filesize($file));
readfile($file);
exit;
?>
and then
Download the mp3
Can you try the below code?
download
I think, it will work on all browsers.
Related
I am trying to setup on my website where I can view a video in low resolution for space saving purposes, then if someone likes the video, I have added into the webpage a link for them to download the full hi-res video. The problem seems to be that no matter what I try I cannot get anything to actually download to my pc from the host server webpage video directory. I have tried many different options that I have found by googling the net. For instance
David Garner
If you are using Opera this will "Stream" and play in your Opera Browser, It will not work on IE11, Google Chrome, Firefox or Safari. And Streaming is not what I wanted anyway, I want someone to be able to download the file to their harddrive to watch later.
Can anyone help me figure out how to be able to download to my pc from the webpage Download link? The primary browser I would like to use is IE, however I am trying to also go for multi-browser support.
* Edit *
After clicking on the link in IE11 it appeared to be thinking so I let it run and after about 5 minutes it started streaming. But I still cant download to my pc the file.
Every time I try to stream or download an .mkv file the page stops responding and Chrome asks me if I want to "kill the page". I tried disabling the VLC plug-in from chrome://plugins but the "VLC Web Plugin" does not exist in my list of plug-ins. Can anyone help me with this problem? I used to be able to play & download .mkv's without issue. I'm not sure what has changed.
I asked this question here: https://webapps.stackexchange.com/questions/45867/cant-play-vine-instagram-videos-in-chrome but it isn't a very populair site form SE so I thought let's ask it here too.
I installed chrome because I have a new laptop. But now when I wan't to play Vine/Instagram video's it doesn't display them. I only get the sound. These video's are .mp4 I guess.
What could be the problem? I've noticed that more people have this problem, but haven't found a solution to this.
I fixed my answer from a user on Web-Applications SE site.
https://webapps.stackexchange.com/a/46108/35759
I had the same problem and was able to use Steve Wingfelder's workaround (numbers added for ease of reading)
Temporary Fix:
Enter “Chrome://flags” in the address bar.
Find an entry that says
“Disable hardware-accelerated video decode.”
Click “Enable”.
Your
videos should now play just fine
Your problem also could be related to plugins. Some found Gokul's suggestion to work:
Type chrome://plugins click on +details find the PepperFlash entry and click Disable.Use only Adobe plugin.
Check your extension causes the trouble.Disable them one by one and check.
I installed about a hundred libraries and plugins to get this working and to my amazement I finally got it working! This is how I did it:
Right click on the Instagram video and select "inspect element"
Copy the video link to clipboard and execute "wget [paste link here]" in a shell.
Upload the video to Youtube and watch it from there.
Remember to set the privacy setting to "Private" to avoid copyright issues when uploading.
Would have saved a lot of my time if I had figured this out right from the start...
I am trying to offer a download option of videos on my site.
I have direct links (which have .mp4/.webm ending) available for download (they are not hosted on my server if that matters).
This is what I tried:
<a href="http://stream.flowplayer.org/bauhaus/624x260.webm" download>Download</a>
It only works on chrome, in FireFox it will just open the video on the browser itself.
You need a wrapper script which sets the Content-Type Content-Disposition headers appropriately, and outputs the file you want to serve.
In PHP this would be done like this:
Filename: 624x260.php
<?php
// We'll be outputting a webm video
header('Content-type: video/webm');
// It will be called downloaded.webm
header('Content-Disposition: attachment; filename="download.webm"');
readfile('624x260.webm');
?>
You would then link to the PHP file instead, as follows:
Download
if you happen to have an apache server where you can edit the .htaccess file, add this line.
AddType application/octet-stream .webm
If you wish to not do this, you could do this through php as well.
PHP Code:
<?php
$file = $_GET['file'];
header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".$file.";");
header("Content-Length: ".filesize($file));
readfile($file);
exit;
?>
HTML Code:
Download the mp3
HTML5 adds the download attribute, which you have there in your example, but is empty. Add a value to the download attribute and hey presto.
ie change download to download="624x260.webm" in your a tag.
http://updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download
For non-HTML5 compliant browsers, the most straightforward way would be to accompany the links with a direction to 'right click to download'. This would cover the majority of cases and browsers.
An overview of a couple of techniques here, I realise you can't zip the files.
http://webdesign.about.com/od/beginningtutorials/ht/download_link.htm
There are multitude more involved ways to do this, including modifying the web server config, but not everyone has the access / know-how to do that.
Note: The download attribute is supported in Chrome 14+ and Firefox 20+.
As an alternative for other browsers, you can use jQuery plugin from here
http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/4
OR
http://jqueryfiledownload.apphb.com/
You can make it downloadable like
Download
$(document).on("click", "a.download", function () {
$.fileDownload($(this).prop('href'))
.done(function () { alert('File download a success!'); })
.fail(function () { alert('File download failed!'); });
return false;
});
I have a webapp that uses an embedded midi file on the page as a part of the functionality.
This works fine for most users. But a significant number of Chrome users have an issue where the midi file does not play at all. Neither is the Quicktime Plugin Permissions prompt activated.There is no JS error on the page. Going to chrome://plugins/ proves that there is a Quicktime plugin installed. The users can't even play a midi file by navigating directly to it. Any suggestions for what could possibly be wrong?
Edit: When trying to play a MIDI file, they see a Quicktime Logo with a Question mark.
Just wanted to add: In QuickTime Preferences under Advanced tab/Media Encoding, make sure "Enable encoding using legacy codecs" is checked....
I had a similar problem with Chrome and the Quicktime plug-in. The plug-in would not play any embedded .mid files. I'm not sure why this method worked, but .... Uninstall the Quicktime program. Open up Chrome and go to the web page with the embedded .mid(s). Wait for the Install Quicktime plug-in alert. Install as directed then close all windows. Go to Control Panel/Program and Features. Find the Quicktime installation. Select "Repair." Return to the web page with the embedded .mid(s). The .mid file(s) should now play as expected.
With the current version of Chrome, that does not help.
I have to switch to FireFox to hear .mid files. Even changing the default .mid player to WMP did not help. Chrome wants to save .mid files to the computer. Obviously a bug.