Open romainpoirier opened 1 year ago
Open the link in a new window, with response having correct type.
Sorry please can you provide an example? Can't figure out what your're suggesting.
I tried to open in a new window (this is working):
window.open(selection.url, '_blank');
But with this in htaccess
, the files aren't downloaded (PDF file is still showing instead of downloading):
<FilesMatch "\.(?i:pdf)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
With this, I haven't the expected result as I can get using the download attribute on a <a>
link.
How to force the response to download it instead of showing it?
I did the window.open(selection.url, '_blank')
thingy and server-side, in PHP, letting the endpoint set application/octet-stream
in the response.
Thoroughly Describe the solution you'd like Download a file on click on suggestion.
Please provide a few use cases for this feature
Please Describe alternatives you've considered My suggestions are download links, and this is my setup:
Even if adding this to the
htaccess
, the files aren't downloaded:If looks like I can't force download from
window.location.href
, so I'm looking a way to act like thedownload
attribute of a<a>
link (which is working fine in modern browsers).