Live data from Hacker News

“Right click and save as” needs to go away

svarden.se

61–70 of 194 posts

Re: “Right click and save as” needs to go away

#61

One small nitpick: please please don't make all your files download with a single filename. In the article it gives an example of "fixing" a hideous generated filename like "203759-fs3.pdf" to download as "invoice.pdf". Yes this is a little nicer, but please be _even_ nicer and put other relevant info in the filename, "invoice-2013-01-01.pdf" is infinitely more useful to me. Context: My bank forces statement download…

Adding the business name in front of invoice-2013-... would be nice too.

Also the sha1sum of the document. Thanks.

Re: “Right click and save as” needs to go away

#62

There are already ways to force browsers to download using HTTP headers. The author says this is a "server-side solutions to front-end problem", okay. But anyways, when pages use this already, it OFTEN pisses me off, when I want to look at a PDF in browser, but the web app/page is forcing me to save it to disk and then re-open it in another app. What we _really_ need, that we _don't_ have a way to do right now -- is…

> when I want to look at a PDF in browser does that ever happen? > but the web app/page is forcing me to save it to disk and then re-open it in another app. because SumatraPDF actually loads faster than Adobe's browser plugin. Plus it's more secure, lacking all the weird scripting crud that shouldn't be in a document format anyway, smaller and open source. Only downside is that it can be really, really, really yellow…

>> when I want to look at a PDF in browser > does that ever happen?

Yeah, I've done it a few times. It's handy when I know I'm not going to save the PDF for any length of time. Using Foxit Reader helps with this since it's a lot lighter than anything from Adobe.

Re: “Right click and save as” needs to go away

#63

I HATE sites that force downloading! I often have a 50+ MBit/sec connection and want to be able to choose between having a PDF (e.g. a invoice - all I need is the amount and the bank data) render in the browser so I can discard it after using (here: wiring the money) and not having to do: 1) download it 2) open it 3) do what I want to do 4) delete the file (which requires me to open the download folder, locate the fi…

Don't other browsers have a "temporary downloads" folder? For when you select "open this file with (...)" in the download dialog? Opera does. Now I finally sort of understand why people like opening PDFs in browser plugins, I suppose ... > I usually end up with a clusterfuck of a download directory (mine has 20 GB already in half a year, most of it is one-off downloads!) yeah well but that is your own fault for savin…

Windows does not have a /tmp, and Chrome doesn't offer an easy(!) way to switch download locations per download.

Re: “Right click and save as” needs to go away

#64
> There are or course other ways of forcing file downloads, such as adding certain configuration to your .htaccess file, but I think server-side solutions to front-end problems should be avoided whenever possible.

I'd disagree with this being a "Front End" problem. You, serving the file, presumably have an idea what you want the user to do with the file. The .html page you propose editing is server side. The file being served is server side. The server configuration is server side. But most importantly, most browsers don't handle that attribute.

So I'd say what you want is the Content Disposition header, specifically, "Content Disposition: attachment". Set a header for the file type you want handled. But that's not enough on its own to cover most browsers in the wild.

Various browsers handle this header differently. Our CDN supports the following headers for files which are viewable directly in the browser. Using the appropriate header will prompt to Save As... even with a normal (left) click.

We recommend number 2 or number 8:

    1. Content-Disposition: attachment

    2. Content-Type: application/x-download 
       Content-Disposition: attachment

    3. Content-Disposition: attachment 
       Content-Type: application/force-download

    4. Pragma: no-cache
       Expires: 0
       Content-Type: application/force-download 
       Content-Transfer-Encoding: binary

    5. Pragma: private
       Cache-control: private, must-revalidate 
       Content-type: application/x-download 
       Content-Disposition: attachment

    6. Content-Encoding: AuraganDownload 
       Content-Disposition: attachment

    7. Pragma: public
       Cache-Control: must-revalidate, post-check=0, pre-check=0 
       Content-Disposition: attachment

    8. Content-type: application/octet-stream 
       Content-Disposition: attachment
This list was gradually added to over the last 10 years. Besides number 2, our main recommendation, the others here are for various edge cases such as popular downloaders or varieties of corporate firewalls, proxy servers, and reverse proxy (edge) caches. I included them just in case you're battling one of those cases and want some other incantations to try.

Re: “Right click and save as” needs to go away

#67
post #17

There are already ways to force browsers to download using HTTP headers. The author says this is a "server-side solutions to front-end problem", okay. But anyways, when pages use this already, it OFTEN pisses me off, when I want to look at a PDF in browser, but the web app/page is forcing me to save it to disk and then re-open it in another app. What we _really_ need, that we _don't_ have a way to do right now -- is…

I think Opera already does that.

I really would love if Dolphin Browser and Opera Mini would open PDF files in browser. Downloading files for viewing and opening PDF reader really isn't nice option, when you simply want to have a quick look what the file is really about.

Google's quick view has saved me many times. But there really should be one simple and good solution for this problem.

Re: “Right click and save as” needs to go away

#70

Earlier quoted context omitted.

> when I want to look at a PDF in browser does that ever happen? > but the web app/page is forcing me to save it to disk and then re-open it in another app. because SumatraPDF actually loads faster than Adobe's browser plugin. Plus it's more secure, lacking all the weird scripting crud that shouldn't be in a document format anyway, smaller and open source. Only downside is that it can be really, really, really yellow…

>> when I want to look at a PDF in browser > does that ever happen? I do this all the time. I hate downloading crap that I'm probably just going to glance at once then discard.

OK yes I understand better now. I never realized that other browsers apparently don't offer the "open with default application" option in the download dialog, like Opera does.

And actually quite some other applications do this (open as a temporary file) as well, it's a very common pattern: 7-Zip, FileZilla, to name a few.

And even if you didn't, there's always a temp directory that gets cleaned next reboot. Though I agree, the browser should take care of this, like most apps.

Post reply on HN