I have some files that I want people to be able to download or view in their browser as they wish. I cannot figure out how to do this simply, setting headers in the host or doing some javascript magic.
The end result should be an html page with 2 links per file listed, one to open in a new tab, one to download the file. I can get one, or the other but not both to work at the same time.
I tried both Content-Disposition options, and they both work but not concurrently. I tried the chrome.downloads api but it is not available in normal html script. I tried this but it download a text file with the link itself in it, rather than the file content. The download attribute is ignored in favour of the Content-Disposition headers, and default to inline, so even not setting it force open and does not allow download.
Content-Disposition: inline
Content-Disposition: attachment
<a href="test.txt" download="text.txt" target="_blank">
Can anyone spot what I am doing wrong?
Sadly it doesn't seem like there is any ways to do that with headers only, I will need to get some amount of scripting involved.