0

I'd like to enable people to save videos and GIFs to their mobile device via my website.

However, currently when the download links are clicked, they open in a new tab rather than prompt the user to save it on their device.

You can test it out here: http://spin360-staging.herokuapp.com/projects/1284/mobile

This is what the download link looks like:

<a href="/projects/1284/export_video?rel=nofollow">
    <icon class="fa fa-download social_icon export_icon"></icon>
    <div class="share_title">Download Video</div>
</a>

How can I create a download link in a mobile browser that enables people to save media on their device?

scientiffic
  • 9,045
  • 18
  • 76
  • 149
  • Possible duplicate of [How to force a pdf download automatically?](http://stackoverflow.com/questions/2598658/how-to-force-a-pdf-download-automatically) – rvighne Jun 17 '16 at 19:44

1 Answers1

0

Try sending the headers below for the resource that the link points to:

Content-Type: application/force-download
Content-Disposition: attachment; filename="filename"

The idea is to change the content type to something the browser cannot open in order to force the download.

rvighne
  • 20,755
  • 11
  • 51
  • 73