How can I cause the target to be saved, as when clicking files in IE11?

I have files uploaded to Amazon S3. In other browsers, such as Firefox and Chrome, I can click and the browser will load automatically. But in IE11, it is displayed directly in the browser. And I want to call "save target as" on IE11 to load this file. How can i do this? Here is my HTML:

<a href="<link>" target="_blank">1.xlsx</a>
+4
source share
2 answers

Short answer: you cannot. Regardless of whether the browser loads the file or displays it in the browser, this is the browser setting, and not something that you can directly control, because of this, you are simply a link to the file directly.

, PHP, HTML, , , .

php ()

+1

, @Nelson, .htaccess

<FilesMatch "\.(?i:doc|odf|pdf|rtf|txt)$">
    ForceType application/octet-stream
    Header add Content-Disposition "attachment"
</FilesMatch>
+1

Source: https://habr.com/ru/post/1612185/


All Articles