Download hint

What is the best way to offer the user something to download? I used to window.open('file.pdf');, but I see that blocking pop-ups have problems with this. Of course, I will include a manual link.

Basically I want something like a Microsoft download page . So what will the script tell you?

+3
source share
3 answers

Redirect using javascript.

function redirect() {
window.location = 'http://www.url.to/your.file';
}
+3
source
Content-Disposition: attachment; filename="file.pdf"

To do this, you can transfer the file.pdf file through a script server that forces its header.

, , - . , .

+1

Set a content placement header with a binding value

0
source

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


All Articles