
“Right click and save as” needs to go away - cfj
http://svarden.se/blog/2013-04-22-right-click-and-save-as/
======
jrochkind1
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 signal
the browser to _prompt_ the user as to whether it should be saved or displayed
in-browser. The browser could ignore unless it was capable of displaying in-
browser of course. That's something we do not have any way of doing in a
reliable way now with HTTP headers, and I wish html5 would add that, instead
of duplicating a lesser feature which is both possible now, and frequently
annoying.

~~~
raverbashing
Which is funny, because I absolutely _loathe_ opening in the browser, I prefer
saving it.

Chrome and FF PDF viewers are better, but with Acrobat it was a bag of hurt.

Also, see: saving is the more generic answer. Save and you can see it, open it
and before the Chrome 'save' button you had to re-download it.

~~~
TillE
On Windows I've yet to see any PDF viewer that's faster or better than
Sumatra. All the in-browser ones are a bit slow and lacking in features.

~~~
tripzilch
But it's so ... _yellow_.

~~~
tripzilch
I was _kidding_ , jeez. I'm a big fan of SumatraPDF and use it everywhere I
can.

However I _have_ actually heard people complain about its yellowness when
started without a document. I don't care Sumatra, keep it yellow.

~~~
Einherji
Seriously though, why all the yellow?

------
chrisfarms
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 downloads to all come out as "statement.csv"
.... once you have a nice collection of "statement [43].pdf" files lying
around you soon long for that hidious generated filename (or a semantically
better one).

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

~~~
noja
Also the sha1sum of the document. Thanks.

~~~
ceol
That would probably scare most users, to see a long filename full of
gibberish.

~~~
protomyth
Could, but putting it at the end of the document would seem pretty normal
given what a lot of users get when downloading stuff. I think url shortners
and tublr image urls probably paved the way.

------
GavinB
For everyone complaining that they don't want to be forced to download--just
have two buttons:

March Invoice: View - Download

This is _much_ clearer for the average user than a single link with hidden
right click functionality. Currently clicking on a link you have no idea what
you're going to get.

~~~
GhotiFish
so would the browser be enforcing that? Or the server?

Because both options are unacceptable.

~~~
gcr
Why are both unacceptable? Server enforcing downloading/viewing measn the user
couldn't override its choice, but providing both links avoids that issue.

~~~
GhotiFish
If the browser presented both choices, it wouldn't be able to distinguish by
situation, so either it would hide downloading inappropriately, or it would
present it inappropriately.

If the server was in charge, then most websites would screw it up through
incompetence or malice.

Two links for every link, or have the server (an entity who doesn't
necessarily have the users interest in mind) having more control over what the
user can do with the content it sends.

Both options suck.

To be fair? I got responses in favor of both options.

------
mschuster91
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
file and delete it).

If I forget step 4, 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!).

~~~
btipling
Browsers (or site owners) could probably do a better job of differentiating
links with download attributes. Maybe on mouse over show a little download
cursor or something.

~~~
NathanKP
To show an icon on hover over a link on the browser side it would require
browsers to make an HTTP HEAD request for each link to see if it has the
"Content-Disposition: Attachment" header. That would add a lot of overhead to
the page load, so I don't think it would be added to any browser.

However, it seems like a good candidate for a browser plugin for those who
have fast connections and don't mind.

~~~
btipling
Note I said in case the download attribute is set on the link, in which case,
no, it would not require any request, it just follows the instructions set in
the HTML.

------
ender7
Note that the "download" attribute is extremely useful when the href is a data
or blob URI [1]. This allows you to construct the file that the user is going
to get in Javascript, rather than server-side. For example, if you wanted to
write an image-editing web app and didn't want to round-trip to the server to
allow them to download a copy.

<https://en.wikipedia.org/wiki/Data_URI_scheme>

~~~
notaddicted
Yeah, this is useful. You can generate the URI in a click handler as well, so
if you need to do some last minute assembly it still seems to work like a
regular download link.

------
Terretta
> _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.

~~~
DigitalTurk
> 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.

The problem is when you want to offer both a view and a download link. Your
solution requires offering two different URLs for that, which also breaks
caching in the case where a user first wants to view and then download the
file.

~~~
Terretta
On the contrary, our solution as implemented on our CDN uses a query string
parameter numbered 1 - 8 to select one of those sets which are then set by the
server in the response. So you can choose it on the fly for any file.

~~~
DigitalTurk
But as far as browsers are concerned <http://x.com?y> and <http://x.com?z> are
two different URLs, right?

~~~
Terretta
Sorry, I was replying about different URLs, you're focused on the caching
question. Yes, most browsers would retrieve again. That's the price you pay
for having the same file be able to be viewed or able to force a download.

As a VDN (video delivery network) we're focused on 100MB - 8GB video files, so
our clients' primary goal is to avoid ever having the file attempt to display
in the browser unless as a media URL purposely supplied to an embedded player.
In general a raw video file URL would be for a download, and forcing Content
Disposition saves having to explain the "Right-click, Save As..." dance
regardless of browser.

------
sergiosgc
What's with Chrome adding extensions to the filename? Is this behaviour
specific to Chrome on Windows or standard across all platforms?

The world does not revolve around windows. File extensions are optional, not
mandatory, in unix land. If the site says the file is named foobar, its name
is foobar not foobar.txt.

~~~
mschuster91
The problem is that Windows desktop market share is overwhelming and as a
Website author, you have to think in Windows user terms!

------
kleiba
_Firefox quirk

When specifying a value for the attribute, Firefox will not automatically give
the file the correct file extension like Chrome does. [...]_

I beg to differ. This is not a "quirk" and Chrome does not anything
"correctly" that Firefox doesn't. From the HTML5 spec, regarding the
"download" attribute:

 _"There are no restrictions on allowed values, but authors are cautioned that
most file systems have limitations with regard to what punctuation is
supported in file names, and user agents are_ _likely_ _to adjust file names
accordingly."_ [1] (emphasis mine)

As we can see, the spec clearly does not require a browser to do anything to
the filename given as download's value. And it seems that the only reason a
browser should consider doing any kind of change -- according to the spec --
is if the underlying OS cannot handle a filename's syntax. I don't know if
Windows still does that but e.g. DOS used to have a restriction that
filesnames must be at most 8 characters, and end in a dot followed by a three
letter extension. Unix-derived operating system do not have the system, so if
the OP is running on, say, on a Mac, there's no reason for Firefox to fiddle
with the filename. It conforms to the standard.

Now, which behavior is more reasonable is a totally different question, of
course...

[1]
[http://www.w3.org/html/wg/drafts/html/master/links.html#attr...](http://www.w3.org/html/wg/drafts/html/master/links.html#attr-
hyperlink-download)

------
jtheory
There's something of a conflict between "The download attribute is supported
in Chrome 14+ and Firefox 20+" and "but I think server-side solutions to
front-end problems should be avoided whenever possible."

The client-side solution sounds nice, but there's still likely a large
percentage of your users for whom it won't work.

So instead of just a server-side solution, to do this nicely you have to have
BOTH a server-side and client-side solution, for now. How is that good?

I suppose you could leave the default & old browser users to fend for
themselves (in a manner of speaking), but sadly the folks who are downloading
a different browser are mostly the same folks who understand how to right-
click.

The ones that need a simple download link are the ones still using their
default browser.

------
foshur
How would a web designer be able to choose my intention prematurely without a
crystal ball?

Not to mention download support in browsers got WORSE over the years. All
major browsers (but especially Google Chrome with its "never ask, just do it"
UI attitude) need a good download manager. I strongly prefer "save as..." over
the mess that the Chrome default download behaviour is.

------
cjoh
Right click and save-as might be annoying but it's also a critical piece of
our tinkering economy. I don't want to use a client that prohibits me from
downloading the web unless it's specified as "permissible" by the author. This
is a step in that direction.

~~~
lukifer
Settle down, no one's taking your right-click away. The author is just
conveying that this is a bad _default_ to force on users for the simple act of
downloading.

If linking to a download, a simple click should do the job; meanwhile, power
users should still able to right-click so as to pick the directory, etc.

------
Thrall
This appears to be trying to solve a problem that doesn't exist with a
solution that is more problematic than the problem it attempts to solve.

If my browser can handle pdfs, I probably want to view them using the
browser[1].

If my browser can't handle pdfs, it will be forced to download them anyway.

If my browser can handle pdfs, but I want to save it/view it with another
program, I can use right-click+save as.

By contrast, a pdf which I want to view in-browser, but which forces the
browser to download it instead is just a nuisance. Even if there were a
'right-click+don't save it, just view it in browser', I don't know that I need
to use it until I have tried clicking the link.

In general terms: You publish content on the web, I decide how I view it. Try
to force my hand and you'll just annoy me into going elsewhere.

[1] If the browser supports pdfs by default, but I prefer to view them with
somthing else, there are usually settings to tell the browser how to handle
different file types.

------
cientifico
"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."

WOW. So http have the solution for that, but as you are lazy, you want to
reinvent the wheel and do it on your own, forgetting that the fronting you are
talking about is running over http.

The http header have a few years now (Content-Disposition). It is not related
at all with apache (even if you mention a way to configure apache).

You give a service to the client, not just a pile of frontend. If you don't
know how to do it, hire some people that knows how the webservers and http
world works!. But what you are saying is that without understanding how http
works, and without any interest on learning it, you want the world to change
to your needs. Isn't it?

~~~
Cederfjard
I'm not entirely sure that I've grasped all of what you're saying here, but
the download attribute is in the WHATWG HTML specification, and can hardly be
considered OP himself trying to reinvent the wheel.

------
fulafel
The PDF case is no problem with the builtin PDF support in Chrome and Firefox.
Or if you like the Adobe stuff, just disable the plugin and you'll
automatically get the download and then a prompt to launch Acrobat Reader.

This is similar to forcing links to open in new windows - assuming the user is
stupid in a way that doesn't even let the user to revert to the normal web
behaviour (no browser function to "open in same window" vs no browser function
to "open in browser")

------
mbesto
QWERTY keyboards need to go away, but they are design patterns that people are
used to.

 _Any file the browser would normally try to display natively or through a
plugin can be forced to download using this attribute._

What if you want to do the opposite? Are we going to have to do "Right+click
and Open in Browser"? What about mobile? Also, as far as I'm aware this issue
is only really with PDF files, as virtually every other MIME extension is not
supported by a browser.

~~~
marcosdumay
> Also, as far as I'm aware this issue is only really with PDF files, as
> virtually every other MIME extension is not supported by a browser.

It's worse with XML files, source code and some kinds of data files (generic
separated by char). Browsers try to open those, and remove important data from
the display (and the copy buffer).

------
nnq
off-topic, but got to say it:

> lots of people are literally afraid of the right mouse button

...c'mon, when will people grow out of this? and by people I mean GUI
designers! One of the reasons I hate the guts of Unity for example is that I
can't simply 'right click' -> 'customize/properties/setting' on anything I
want to change in the UI. I don't want to go to a 'control/settings panel'
(that may not even have the options I care about) to change settings, I just
want to go around and right click on things I want to tweak. Or if I want to
invoke one of the alternate actions for an UI element. I know nowadays we are
designing UIs for retards (pardon, 'cognitively overloaded busy people' is the
term) and not power users, but this kind of hidden 'power user' functionality
doesn't hinder 'average joe' in any way. _This is one of those things that
old-school Microsoft UI design guys got right, but nobody gets it nowadays!
(it can also be long-tap on touch screens or ctr-click on macs, but you need a
universally known way of showing a menu connected to any UI element, a menu
that also includes a shortcut to the particular preferences for it)_

~~~
Thrall
I think perhaps there is an increasing tendency to design one UI for every
platform (touch screen tablets, desktops etc.) and to favour consistency
across platforms rather than proper integration within each platform. So if
right-click is difficult to emulate on a touch screen, then often the desktop
version of a program available for touch-screen devices won't make good use of
right-click either.

It is perhaps part of a larger trend to try and solve UI problems for tablets
and phones, then push the solutions back to the desktop, despite the fact the
desktop didn't suffer from the problem they attempted to solve.

------
Samuel_Michon
Browsers that support the download attribute in HTML5
<http://caniuse.com/#feat=download>

– Chrome, from version 14

– Firefox from version 20 (current)

– Android Browser from version 10 (current)

– Chrome for Android from version 25 (current).

~~~
rivd
and again... no IE.

(as the article mentions: work-around needed with conditional comments)

absolutely off-topic and yes a bit unreasonable, but after years of
webdevelopment, i'm getting a little cranky at every mention of this "browser"
that microsoft forces developers to put up with. Yes, i know this is a "new"
html5 feature and that i cant expect corporations or consumers to keep in-
house browsers up-to-date, but really: its a microsoft failure. Is it really
_that_ hard to keep up with the competition?

------
obviouslygreen
Take a lesson from the user backlash that happens every time a browser removes
a feature: Don't do that. The best you can do is encourage developers to use
an alternative. The worst you can do is to force it on people who don't share
your point of view.

~~~
Zirro
He isn't saying that browsers should remove the "Save as..."-feature. However,
he is suggesting that browsers and websites should implement the download-
attribute, which he believes will make the need for "Save as..." go away in
those cases.

~~~
jtheory
Further: the article is about browsers _adding_ a feature for HTML5 developers
that formerly required tinkering with HTTP headers on the server-side.

There's nothing in there about disabling Save-As.

------
kevinpet
Designers who think their site should behave differently from web standards
need to go away. This is completely inappropriate for typical sites. It's only
appropriate for web apps that really do deal with files.

------
smosher
Sure fine, as long as there's a "launch handler anyway" context menu option. I
don't care what people think they need to say as long as I have a way of doing
the things I want to do anyway.

Case in point: If I want to save a PDF I usually save it from within Okular.
If Okular crashes while handling the PDF for display it's useless to me
anyway.

------
mitchell360
I don't agree with the final point, "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."

If we are trying to FORCE a download, then this really is a server-side issue.
If we want to give the user the choice, then it is a front-end issue.

The crux of the article is all about taking away the user's choice ... and so
a server-side solution seems more reasonable per @jrochkind1.

------
bpatrianakos
I like this except for the last part where he mentions that he doesn't like
server-side solutions to front-end problems. The way I see it, this _is_ a
server-side problem that only shows up on the front end. If we're talking
about sending headers that tell the client to download something then that
should be coming from the server. Now, it's awesomely convenient that HTML5
lets us do this but still, I see it as something that still "belongs" on the
server side. Just my take on that last part.

------
Sami_Lehtinen
Yuck, browser specific things? What about the browsers you didn't mention? I
would prefer there to be one standard way, not complicated tricks to be set up
for each browser.

My GF also hates to download files for viewing. Why I have to download this
video, pdf, audio file, why I can't simply use it in the browser. I simply
want to see the content, not to save the file permanenty on computer.

------
gioele
Doesn't this break the XHTML serialization?

IIRC, the HTML 5 `<elem attr>foo</elem>` is equivalent to its XHTML
representation `<elem attr="attr">foo</elem>`. The implicit value of the
attribute is duplicated in the attribute value.

In this case this would lead to `download="download"` as if the suggested
filename is "download", not "use the filename found in the URL".

------
puddinman13
I was hoping that at least IE 8 would support a client side fix for this, but
hey who would ever assume that IE would support something.

------
slacka
For people that want to test out the download attribute, instead of just
reading about it, you try a demo here on your browser:
<http://davidwalsh.name/demo/html5-download.php>

Also, as GavinB suggested for big .pdf and .jpg files, I would would prefer 2
choices,"save" and "view" buttons.

------
pow-tac
Does it also work for the Data URI Scheme,
<https://en.wikipedia.org/wiki/Data_URI_scheme#HTML>

Example: <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

------
_cipher_
"Right click and save as" is the last thing to go away imo.

There are a LOT of things that need to go away first (to name a few: crappy
development, obligatory js to view content, AWFUL prefixes (-o-, -webkit-,
-whatever-) and of course browsers that suck your RAM like there's no tomorrow
(yes, I'm talking about firefox and chrom{e,ium})).

But again, that's just me. :)

------
laurent123456
> Firefox quirk - When specifying a value for the attribute, Firefox will not
> automatically give the file the correct file extension like Chrome does.

I think the quirk is the other way around. I always dislike it when Chrome
suddenly decices to add a ".txt" extension to the file I've just downloaded.
It sometime even does this .js files.

~~~
eurleif
If the files were being served with a text/plain MIME type, it's sensible
behavior for Chrome to add .txt, and it's the site's fault for sending the
wrong type info.

------
shurcooL
What's really annoying to me is when links start downloading instead of
opening the file in the browser. Is there any way to force Chrome to open a
certain link, the way you can force it to download via "save as"?

------
MRSallee
"Right click" is meaningless to Mac laptops and every mobile device. For that
reason alone, I dislike using the text "Right click to save."

I dunno how I feel about forcing a download without a bit more clarity to the
user.

~~~
afandian
I'm on a Mac laptop and an Android phone and it's very meaningful to me. I
think it's fairly well understood that "right-click" means "context menu". On
the Mac I access the context menu by two-finger clicking or by holding ctrl
when I click. On my Android mobile device I tap and hold.

------
mikecane
Let's say that gets adopted everywhere. For people like me who are used to
doing RC/SA, you'll have to put a "No Need To RC/SA" prompt. You can't win.

------
jbrooksuk
No, no it doesn't. It's taken this long to ingrain in every single computer
users brain how to do this. To change it now would be a nightmare.

------
Aloha
No.

Sometimes I want to open the pdf in the browser, I often to not want to save
it until I have been able to look at it and see if its what I want.

------
ninakix
I think we decided the whole "open in a new window" thing is annoying? Why not
just leave the decision to the users to decide?

------
rudiedirkx
They're not the same... The user should have final control and without
'rightclick & save' they don't.

------
tomphoolery
Wow, this is so useful and I never even knew it's been around. Thanks so much!

------
Ideka
The "Firefox quirk" sounds more like a Chrome quirk to me.

------
rocky1138
Control-click would work much better than this attribute.

------
nextstep
Does Mobile Safari support this download attribute?

------
ubersync
Should I be surprised that it doesn't work in IE?

------
mchanson
Who was still using 'Right click and save as'?

~~~
stan_rogers
I certainly do -- I almost always want to change the file name to something
that makes sense at my end. I don't often care what makes sense at the
creator's end; I want to find the file quickly when I need it.

------
racl101
Well, when all browsers support the HTML 5 download features then maybe the
'Right click and save as' can go away. Until then it stays.

