Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Download Attribute not working

I've experienced some unexpected behavior of Chrome since the newest version: While in Firefox this Code is working Perfectly fine:

<a id="playlist" class="button" download="Name.xspf" href="data:application/octet-stream;base64,PD94ANDSOON" style="display: inline;">Download Me</a> 

It isn't working in Chrome (Simply downloading a file named "Download"), but has worked pretty fine before. What do I have to change that it is working again?

like image 930
Buffer Overflow Avatar asked May 26 '14 14:05

Buffer Overflow


1 Answers

After some research I have finally found your problem.

<a> download attribute:

If the HTTP header Content-Disposition: is present and gives a different filename than this attribute, the HTTP header has priority over this attribute.

If this attribute is present and Content-Disposition: is set to inline, Firefox gives priority to Content-Disposition, like for the filename case, while Chrome gives priority to the download attribute.

Source

HTTP-Header Content-Disposition

like image 191
Emanuel Vintilă Avatar answered Sep 22 '22 08:09

Emanuel Vintilă