Skip to content Skip to sidebar Skip to footer

Sorry Were Having Trouble Opening This Item This Could Be Temporary but if You See It Again You

In that location are already means to force browsers to download using HTTP headers. The author says this is a "server-side solutions to front end-cease problem", okay.

Merely anyways, when pages employ this already, information technology OFTEN pisses me off, when I want to await at a PDF in browser, but the web app/page is forcing me to save it to disk and then re-open up information technology in another app.

What we _really_ need, that we _don't_ take a manner to practise right now -- is signal the browser to _prompt_ the user equally to whether it should be saved or displayed in-browser. The browser could ignore unless information technology was capable of displaying in-browser of grade. That'due south something we do non have whatsoever manner of doing in a reliable style now with HTTP headers, and I wish html5 would add together that, instead of duplicating a lesser feature which is both possible now, and oftentimes annoying.

Which is funny, because I admittedly loathe opening in the browser, I prefer saving it.

Chrome and FF PDF viewers are better, merely with Acrobat it was a pocketbook of injure.

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


"Before the Chrome salvage button"? What does that fifty-fifty mean? Half the time I see people praising Chrome it's because of something thoroughly mundane, like an address bar, or saving files, or links. Did you guys browse the web using potatoes before you got Chrome, or what?

It means Chrome comes with a built-in pdf reader that, when you lot decide to save the file you're looking at, does non re-download information technology. This is significant when dealing with large files, and not a feature present in all competing products.

However, I would recommend re-downloading any pdf files instead of saving them from Chrome's reader, since I've encountered a couple that Chrome corrupted upon saving.

It seems kind of silly that certain browsers download it again. Isn't it stored as temp information somewhere? They should only have to rename it.

I'm actually happy with the way Chrome handles downloads in that information technology starts the download before yous confirm if you lot desire it, then deletes it should you make up one's mind you don't. Information technology'southward cool clicking the "Download" link, navigating to the folder, renaming the file, and seeing the download is almost done.


Netscape (IIRC) would do some other GET (or Postal service!?) when doing a view-source, which NEVER EVER made sense to anyone I would demonstrate it it. I want to run across the source of the page that's currently rendered, not the source of another Post asking. That behaviour thankfully seems non to exist nowadays in any modern browsers.


I may exist misremembering, just didn't NN also re-GET on RESIZE EVENTS? I'm sure there was a very clever reason for doing so, just information technology sure did piss me off at the time.


I concur that the Acrobat plugin was a pain (and I always made sure to disable it in Firefox), just I admittedly love the Firefox in-browser PDF viewer. Information technology doesn't lock up the PC while loading, and it has a convenient download button that doesn't seem to redownload the PDF when clicked (much like saving an already loaded image).


Information technology might have something to do with my PC (i7 x220) but I cannot stand the Firefox viewer for annihilation but plain text. I find information technology very lacking in terms of operation compared to a native pdf viewer. Everytime a somewhat complex pdf opens upwards (by and large formulas, few images), the fan begins to rev upwardly significantly..


Firefox's reader is an improvement over Adobe's, sure, only that's like beating snail in a foot race. Get Firefox, y'all testify'em Chrome! It's still not SumatraPDF, it'south non Evince. Saving the file and having it auto-open up these programs takes less time and then waiting for the browsers PDF readers to kick in. Of course it could be better, but bluntly, I'd rather things be more than unix'y, not less.

A major trouble with saving all pdf files to be opened in a separate program is having to delete the temporary files afterwards. That's non very unix-y.

Another, less common, trouble is erasing the URL in the process.

> having to delete the temporary files afterwards

If yous select "Open with..." instead of saving it, you lot don't take to. Honestly though I oftentimes find myself wishing I'd saved a copy later.


It's funny how many Windows users seem to think the PDF format is intrinsically slow, and all because of Acrobat Reader. Safari on Bone X renders a PDF simply as chop-chop as any other webpage, and e'er has.


I imagine if you were to test that so the PDF rendering would really be significantly faster than HTML, since Bone 10's rendering is all PostScript under the covers.


On Windows I've notwithstanding to see any PDF viewer that's faster or better than Sumatra. All the in-browser ones are a bit tedious and defective in features.

I was kidding, jeez. I'thou a big fan of SumatraPDF and use it everywhere I can.

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


I've been using Sumatra for a long fourth dimension, just information technology's been supplanted past Firefox in most cases recently. Sumatra is great and lightweight though, and it uses a robust and open source rendering and parsing engine.


If Chrome didn't offer any mode to 'save equally' a PDF that it was displaying (really?!?), that's clearly Chrome's problem.


Unless it comes from one of a number of periodical or research sites, where at to the lowest degree one of those options volition no longer work.


That's cause yous aren't actually looking at a PDF, most likely. If you are really looking at a PDF in Chrome'southward renderer you will definitely be able to salvage it.


I'd besides rather download and open in Sumatra but this is a handy feature I wasn't aware of. Opening the link in a new tab will non force the download (Chrome) different changing headers and masquerading the file every bit an application.


I would love to have an option in the right click menu to IGNORE the HTTP headers. For example, sometimes at that place is a link to an epitome similar a jpg or a png that then forces you to download information technology. It REFUSES to ever return it in your browser. A correct click option to ignore all MIME types and show it based on extention or magic bytes in the file would be AWESOME. Why do no browsers have that?

Content-Disposition attachement is one of the hardest things to implement when y'all have UTF-8 filenames. Y'all have to browser sniff, and fifty-fifty then I have haven't found a good solution.

Does anyone know of a skillful resource that explains all the edge cases that must be handled?

See [1] for a very comprehensive and up-to-appointment tabular array of browser support for various encoding schemes. Come across [2] for browser-specific hacks.

Summary: most modern browsers including IE9 support RFC2231/5987. (Edit: see my other comment in this thread for IE6-8.)

Another option is to leave out the troublesome "filename" parameter altogether and utilise the last part of the URL to convey the same data, e.g. /files/uploads/2013/<file_id>/filename.ext. Later all, most browsers already understand how percent-encoding works in the URL. With today's URL rewriting engines, this shouldn't be likewise difficult to achieve regardless of how your files are actually organized on disk or which linguistic communication you lot utilize to perform admission control. It would be as if the client were requesting a static file.

[1] http://greenbytes.de/tech/tc2231/

[ii] http://stackoverflow.com/questions/7967079/special-character...

Thanks. These days it looks like a reasonable solution is to just call the file "download.ext" for anything older than IE9.

When I was trying to implement a solution to this problem years ago, what I idea would have 20 minutes of coding, started to look like a calendar week of research and testing, and I gave up.

In my feel, IE6-eight can handle UTF-eight filenames if (1) the extension is alphanumeric; (2) y'all pct-encode the rest of the filename, making sure that whitespace is encoded as "%20" rather than "+"; and (3) you put the whole affair between double quotes. Use RFC2231 for all other browsers, although slightly older versions of Chrome and Safari might cause trouble from fourth dimension to time.

But nowadays I'm so comfy with just using the URL that the above encoding schemes just feel like unnecessary hassle. HTTP was designed to brandish the filename in plain sight in the URL, not bury information technology in a header. Use it every bit intended and even IE volition happily comply.


That's a pretty good idea -- possibly a "prompt" attribute instead of a "download" attribute.

Lends itself reasonably well to a JS-but implementation, besides:

                                                                      http://jsfiddle.net/FLa8P/1/                                

Nice, that JS is a great idea, thanks.

And of form it relies on the download aspect. Then, okay, I guess the `download` attribute DOES make this possible with a bit of JS, where it wasn't before, okay, one stride frontward.

One nice feature of your solution is the user can still skip the prompt with a right-click or modifier-click 'salve as' or 'open in new tab'.

Nicely done. I'm gonna use that in the future. To be more than strictly legal, I'd apply a `data-prompt="true"` attribute or something, instead of a not entirely legal made up 'prompt' attribute.


The security implication in this instance is non directly related to content-disposition. It could just as well be implemented using the download attribute. The gist of the attack is that information technology was possible to inject arbitrary javascript into an html file that was downloaded. After opening the file locally, the usual browser protections do non apply since information technology's a local file and the javascript can use this to escalate its privileges.

Good indicate, simply such a prompt would exist similarly annoying (i.e. annoying to a similar number of users). The way I've done this in the past has been to provide 2 links, one of which triggered the inclusion of HTTP headers at the server, to trigger the Save dialo). Assuming the download attribute is supported, information technology'due south even easier:

                                                                  <a href="file.txt">File</a> (<a href="file.txt" download>Download</a>)                                                              
This could impact visual design in a negative way. A download icon[ane] could be used instead.
                                                                  <a href="file.txt">File</a> <a href="file.txt" download form="download-icon" championship="Download this file">Download this file</a>                                                              
CSS would be used render an icon and to make the text of .download-icon conveyable only in not-graphical browsers.

[one] http://fortawesome.github.io/Font-Awesome/#icon/icon-downloa...

> What we _really_ need, that we _don't_ have a way to practise right now -- is betoken the browser to _prompt_ the user as to whether it should be saved or displayed in-browser

Like "right-click and save-as"? I personally don't mind the small choice I get to make when downloading a file.

Correct, some browsers do, some don't. (I used to exist able to _get_ Firefox to, with the right config, just stopped being abel to effigy out how, and so switched to chrome where i haven't figured out how either).

Just what we need is a standard cantankerous-browser way to request this beliefs (prompt for download vs show), that by default standards-compliant browsers will comply with (I'll allow for users over-riding this default beliefs with configuration, if the browser wants to back up that, sure).

We don't have that. I wish html5 would add that, instead of minorly improving an annoying affair we already have (way to bespeak the browser to force or default to download).

Sure, it should be avail in the HTML not just in HTTP headers, and so the browser can let the signal effect it's UI earlier it does an http request for the nugget, sure.

>Merely what we need is a standard cross-browser way to request this beliefs (prompt for download vs show), that past default standards-compliant browsers will comply with (I'll permit for users over-riding this default behavior with configuration, if the browser wants to back up that, sure).

It would be annoying too. If I want to open agglomeration of such links as background tabs then I would demand to temporally modify this setting and don't forget to render it.

From usability standpoint (ignoring security and functioning considerations) it's meliorate to show me content and save button simultaneously. And then why do it only when site author wants it? Saving images is mutual performance and it would exist better to prove save push button for every not-dynamic content.

Why modern browsers don't have save button (https://upload.wikimedia.org/wikipedia/en/0/0f/Opera_3.62.pn... ) on toolbar past default and want users to utilize menus for such mutual functioning? Because designers don't have a identify to put it without reducing usability for most common scenarios of browser apply. Too save button was not replacement for "Relieve as" in context carte du jour.

Do we have solution for situation when application is complex enough that there is bunch of operations which are used rarely but must be easily accessible in one click and could exist context-dependant?

Yeah. Microsoft's Ribbon.

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 choice, when you but want to have a quick expect what the file is actually about.

Google'south quick view has saved me many times. Only in that location actually should exist one uncomplicated and good solution for this trouble.


Mobile Chrome often gets this correct. For many file types it will enquire what you desire to do if y'all haven't set up a default action. Merely never set a default and information technology always asks.


Isn't that exactly what browsers ask y'all when y'all click in "Relieve as"? Ok, it'due south not "display in browser", information technology'south simply "brandish" (or "open"), but what's the departure?


Generally the "open" choice opens in another app, not the browser. Including for formats the browser actually displays better.

Agreed. Depending on context (of the content and myself!), sometimes I'll want to save and sometimes not.

A prompt from the browser would be the best pick, merely alternatively, I'd want the site to offer me an choice as to how the external file should exist handled. If the browser doesn't implement it, it says that the "Right click to save" nonsense could brand sense.


I moved to Chrome just to be able to come across PDFs in browser. Lots of websites have info that way (restaurants are the worst) and I don't want to become it saved on my reckoner just to have to delete it!


The option approach with the power to gear up a default is the best arroyo. And so depending on the default, the right click will show the non-default option.


I similar the current method in Safari that opens PDFs in browser by default, but if I wast to save the PDF to disk, I just Option-click.

> when I want to await at a PDF in browser

does that ever happen?

> only the web app/page is forcing me to save it to disk then re-open information technology in another app.

because SumatraPDF really loads faster than Adobe'southward browser plugin. Plus information technology's more secure, defective all the weird scripting crud that shouldn't be in a document format anyway, smaller and open source. Only downside is that it tin be really, really, really xanthous.

> does that ever happen?

Yes, I practice this all the fourth dimension. I read a _lot_, and I ofttimes don't want to save the file on my difficult drive unless I'm going to refer to it once again in the futurity. And if I practise, I tin can just choose "Save" at that point.


I set my default download location to /tmp, which on my OS is automatically cleaned up. If I desire to keep something I movement it to my dwelling directory after looking at it. Otherwise, I can just forget almost it.

As long as people (generally academia and enquiry orgs) continue to publish their content exclusively in PDF form, and so there volition be a demand to look at that content in a web browser.

I work at a university and it is astonishing at how much content exists but as a PDF, even if it would be better suited equally regular former HTML content. Trying to turn that transport around would also interfere with numerous business concern processes and entrenched means of doing things.

I've tried to get people to terminate with the PDF madness, only the admin who follows a publish procedure written downwards on a set of ten-twelvemonth-sometime Mail service-It notes simply just does non get it.

To be fair, there are a number of advantages to having content in PDF's rather than HTML. For case,

1. The formatting is more than static. Papers and memos and other documents are created and intended to exist artifacts, not but mutable data, and PDFs tin can preserve that ameliorate. In ten years, the PDF volition expect more like it did originally than HTML in tomorrow's browsers.

two. They're more durable. As a self-independent document, they don't rely on externally served files such as JavaScript and CSS. Ideally near HTML files are capable of presenting their semantic content fifty-fifty when you strip all that away, but that'due south easy to get wrong (specially with the advent of customer-side templating and JavaScript frameworks). It's easier to archive a PDF than a web page, just salve it to a thumb bulldoze and it'due south pretty much guaranteed to work.

3. It's every fleck as future-proof equally HTML. With multiple contained implementations of PDF viewers, many of which are open source, the format is not going away. Information technology will be readable for years to come up.

PDF preserves layout whereas html doesn't (generally, although it can preserve layout somewhat if you specify one font, fix font sizes, and fix all dimensions), but that's a negative for PDFs.

Different displays have dissimilar resolutions and different dimensions. That makes fixed layouts obnoxious to read on e-readers. The well-nigh obvious example of how fixed formatting is an abomination is a PDF on an ebook reader.

In that location is one reigning reason for having a fixed page layout: ability to cite pages, eastward.chiliad. for academic citations.

In that location is no need to cite pages for works that accept good digital versions, other than antiquated citation requirements (e.grand. MLA/CMS). Ebook readers take text search. Cite a digital form of the work, and anyone with that work in digital form can detect it... an exception being OCR'd pdfs and ebooks converted from PDFs, because OCR frequently screws up line breaks or has other errors that make searching unreliable.

For less-granular searching, at that place's section, tabular array, and image numbering/labeling. Once again, stock-still layout is non required to brand content searchable.

I think you're missing a key part of citing (at least for me), paraphrasing. When discussing sentiment or similar without quoting, you wouldn't know what to search for. Information technology makes sense to requite a page number to review and get more information on the source, without that you wouldn't know where to look. Yous'd have to read the entire source.

For text, but section in your "less-granular searching" would piece of work, and not necessarily particularly well. Page number would oft be more granular, and that'south what's needed for paraphrasing - exactly where to find what you're discussing - merely not exactly what information technology said.

If you're paraphrasing, and then you could straight-quote a critical function of the text so that a reader knows what to search for.

A writer could also adopt folio-neutral paragraph or sub-paragraph numbering. This is common, for instance, in classical texts (where such numbering has been done retrospectively, by scholars, because of the difficulties of citing passages with so many translations - the same general problem that paraphrasing has). To cite a few major examples, Plato's and Artistotle's works have such numbering, as does Hobbes' Leviathan.

Folio numbering has poor granularity for citations in real scholarly work (where y'all'd ideally desire to be able to cite within a few lines at most), and it prohibits flowed text. If someone has some case where they think they need folio numbers for citations, they should figure out an alternative (a few of which take been outlined in a higher place).

No, I totally agree with you on all those points –– and they definitely highlight the value of PDF every bit a format.

My quarrel is with misapplications of PDF as a style of presenting regular old page content that would probably never go printed, stuff such every bit lists of contacts, FAQs, blog posts, etc.

I piece of work with folks across a university who know how to make a PDF and embed a hyperlink into a folio...and that's all they tin can exercise. Their content might be better off as a regular page, merely it'due south a PDF considering that's how they learned to upload content to a website in the absenteeism of a CMS. I know, it'south weird, but that's what I see on a solar day-to-day basis.

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

Yeah, I've done information technology a few times. It's handy when I know I'grand non going to save the PDF for any length of fourth dimension. Using Foxit Reader helps with this since it'southward a lot lighter than anything from Adobe.


>> when I desire to wait 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 one time so discard.

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

And really quite some other applications do this (open as a temporary file) as well, information technology's a very mutual pattern: 7-Zip, FileZilla, to proper noun a few.

And fifty-fifty if you didn't, there's always a temp directory that gets cleaned next reboot. Though I concur, the browser should accept care of this, like well-nigh apps.


Default application, yes. A browser tab, no. When I just desire to look at an paradigm, firefox is largely preferable to gimp. When I have a bunch of pdfs, firefox tabs are easier to manage than evince windows.

One small nitpick: please please don't make all your files download with a single filename.

In the commodity 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, simply delight be _even_ nicer and put other relevant info in the filename, "invoice-2013-01-01.pdf" is infinitely more than useful to me.

Context: My bank forces statement downloads to all come out as "statement.csv" .... once y'all have a nice drove of "argument [43].pdf" files lying around you soon long for that hidious generated filename (or a semantically improve one).


Could, but putting information technology at the stop of the document would seem pretty normal given what a lot of users get when downloading stuff. I think url shortners and tublr paradigm urls probably paved the way.


yeah, simply sorting files past date added is usually footling, and then I'd rather have the selection of group all of the invoices together. But I completely agree that people should proper name these files to brand sorting easier and more useful.


Ah, but date added is non always equal to the date of the invoice. Ex: download 2013-01-01-invoice.pdf today (2013-04-23).

> Yes this is a little nicer, just please exist _even_ nicer and put other relevant info in the filename[...]

Yes - another one of my pet peeves is "logo.png". WHICH logo!?

I could not agree more. Why, why, WHY don't people set metadata fields for PDFs (and other documents, but especially pdfs) and why don't websites use/crave that metadata? Nosotros could be running a semantic web right now and be a year or two alee of where we are if people would really think more one step ahead.

/smoke


that's definetly a very good idea. Customize your filenames with a relevant proper name , adding the date is a very good practice, and why not the user/customer proper name too ( for invoices,etc ... ).

For anybody lament that they don't want to be forced to download--simply take two buttons:

March Invoice: View - Download

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


Problem is that if the browser doesn't back up viewing of the file, and so both links will cause a download, which tin exist confusing to the user. I remember we need a way to see if a MIME type of a file is supported by the browser (including its plugins.)


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

If the browser presented both choices, it wouldn't be able to distinguish past state of affairs, so either it would hide downloading inappropriately, or it would present it inappropriately.

If the server was in charge, and then most websites would screw information technology upwards through incompetence or malice.

Ii links for every link, or take the server (an entity who doesn't necessarily take the users interest in mind) having more than command over what the user tin do with the content information technology sends.

Both options suck.

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

The browser is enforcing that, unless y'all tell it non to, like y'all ever can with a browser.

At to the lowest degree it'south not Javascript.

I Detest sites that strength downloading! I oft have a 50+ MBit/sec connection and desire to exist able to choose between having a PDF (e.thou. a invoice - all I need is the corporeality and the bank data) render in the browser and so I tin discard information technology afterwards using (here: wiring the money) and non having to practise:

i) download it

2) open information technology

iii) do what I want to do

four) delete the file (which requires me to open the download folder, locate the file and delete it).

If I forget step 4, I unremarkably terminate up with a clusterfuck of a download directory (mine has xx GB already in one-half a year, most of it is 1-off downloads!).


I don't know what OS you lot are using, but on linux, I salve all of those files to /dev/shm. Since this parks it in shared memory, one time I restart my reckoner at some point, they will be gone. The same can be done by using a tmpfs every bit your default download destination and a script that cleares any file older than x days etc. I basically use 2 download folders: ~/Dowloads/* and /dev/shm/; the first is being used for Downloads I'd like to continue, the latter for temporary files.


Unless your distribution of choice implements /tmp equally tmpfs, which iirc Fedora does! ;) But yes, /tmp works equally well!


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

In the "old times" Firefox asked me whether I wanted to download and and then open, download into temp and then open up, or download into a to-be-selected folder; with an addon I could force browse render as an option, too.

Withal, this required two mouse clicks in the "worst case" that the default selection didn't fit.

I call back the all-time solution is: if no download attribute set and Content-Disposition is not "attachment", then return in the browser. If either condition is met, open up a popup with large buttons immediately executing the action: download to default folder, download to temp (which volition be deleted upon adjacent browser start), download to specific binder, render in browser (if there'due south a registered handler plugin for this mimetype). Peradventure add a checkbox "Open after download has finished", and peradventure also add together one "Try multi-stream download" (because many sites still limit single-stream bandwidth). Even more than maybe, for video files add a "Preview with VLC" and fetch the required parts (header and final part of video) beginning, and then I tin stream and go on the file for later usage.

Firefox nevertheless does exactly what y'all ask for exactly the same mode it did in the "onetime times".

But go to Options->Full general->Downloads, tick Always enquire me where to download files

Net Explorer likewise works like this practically eliminating footstep ane,2 and 4 from your scenario above.

To show an icon on hover over a link on the browser side it would require browsers to make an HTTP Caput request for each link to see if it has the "Content-Disposition: Attachment" header. That would add a lot of overhead to the folio load, and so I don't call up 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 listen.


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

Don't other browsers have a "temporary downloads" folder? For when you select "open up this file with (...)" in the download dialog? Opera does.

At present I finally sort of sympathize why people like opening PDFs in browser plugins, I suppose ...

> I ordinarily end upward with a clusterfuck of a download directory (mine has xx GB already in one-half a year, most of it is i-off downloads!)

yes well simply that is your own fault for saving temporary downloads in a non /tmp directory. just put them somewhere where they'll go cleaned out every so often. this is a computer, you lot don't even have to take the trash out yourself, but it's withal upwardly to you to differentiate betwixt "to discard" and "to keep".`


But rarely, applications do this. The only notable exceptions is Winrar temp-extractions and some installers. Most other products merely permit their stuff rot in TEMP hell.


Actually there are two TEMPs, ane Local Settings and one Roaming Settings TEMP. Merely unlike nearly linuxes, Windows doesn't clean them, and some applications even fuck up when you delete their temp-stuff.


Yes, exactly this extension I talk about in another reply - but I don't use Firefox whatever more because it creates disk load and swaps heavily on a 5400rpm deejay, and it locks up while waiting for deejay i/o every x seconds (every tab switch, in essence). Chrome's unmarried-process-per-folio model is ameliorate, because the OS can practice proper swapping.


Interesting in that I've seen the verbal reverse: Chrome hits the deejay a lot harder, particularly on startup, compared to Firefox.


This is true, the cold startup takes longer in Chrome than in FF. Only if you're brusque on RAM (I commonly hit 2-3GB usage without a browser running) and the OS starts swapping when you open tabs (I have ~30-xl open regularly), then the difference appears.

1) I don't think your use case / preference is that mutual. I'd venture that most of the fourth dimension a download is preferable; I know that's the case for me.

2) Fifty-fifty if I'm wrong virtually 1), it's hard to argue that in that location is never a skillful fourth dimension to forcefulness a download, and so this is a useful characteristic to know nigh. I wasn't aware of it so appreciated the post.


I'm well-nigh never on a l+ MBit/sec connection, which brings up another bespeak. When on a tedious, information-capped connection, such equally the i I'm on right at present, I want to know the size of the file I'm downloading. That lets me decide if it's actually worth spending my precious bandwidth on. If not, I cancel the download. When letting the browser display the file there's no (easy) way of finding out the file size.

From the Firefox normal behaviour, I imagine it would enquire you whether you lot wish to open the file in the Os registered handler or save it. If you tell it to utilise an external program, FF downloads to temp, not to the Downloads directory.

So, no clusterfuck. Anyhow y'all are right about the lag caused by downloading the whole file.

The problem is that FF does non read the OS list of programs (or can call the "Use OS selection for program/Open With"), but has "its own source" - on Linux, this sucks, because if I want to specify an unknown plan, it's most probable in /usr/bin, which has thousands of files and so blocks the disk for a huge time while reading the file list.

On Windows, it sucks too, because I have to go to c:\, then remember if the program is x64 or x86, and then remember the producer of the program, hope the programme files-directory is named later the producer or the software, and so find the right .exe to open. SUUUUCKS.

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

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


Yeah, this is useful. You can generate the URI in a click handler besides, so if yous need to do some final minute assembly information technology withal seems to piece of work like a regular download link.


> There are or class other means 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 y'all 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. Only most importantly, about browsers don't handle that attribute.

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

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

We recommend number 2 or number eight:

                                                                      1. Content-Disposition: attachment      2. Content-Blazon: application/x-download         Content-Disposition: attachment      iii. Content-Disposition: attachment         Content-Type: awarding/force-download      four. Pragma: no-enshroud        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: zipper      vi. Content-Encoding: AuraganDownload         Content-Disposition: zipper      7. Pragma: public        Cache-Control: must-revalidate, post-check=0, pre-check=0         Content-Disposition: attachment      viii. Content-type: awarding/octet-stream         Content-Disposition: attachment                                                                  
This list was gradually added to over the final 10 years. Besides number 2, our main recommendation, the others here are for various border cases such as popular downloaders or varieties of corporate firewalls, proxy servers, and reverse proxy (edge) caches. I included them just in case yous're battling i of those cases and want some other incantations to try.

> 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 existence served is server side. The server configuration is server side.

The trouble is when y'all want to offer both a view and a download link. Your solution requires offering 2 dissimilar URLs for that, which also breaks caching in the case where a user first wants to view so download the file.


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

Deplorable, I was replying about different URLs, you're focused on the caching question. Yes, well-nigh browsers would retrieve over 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) nosotros're focused on 100MB - 8GB video files, so our clients' master goal is to avoid ever having the file attempt to display in the browser unless every bit a media URL purposely supplied to an embedded actor. In general a raw video file URL would be for a download, and forcing Content Disposition saves having to explicate the "Right-click, Save As..." trip the light fantastic toe regardless of browser.

Information technology's good to run into such a comprehensive list, only these only assistance me if I want to configure download vs view on a per-filetype basis?

There's no way to brand some pdfs "display" in the browser and others force download using these headers, correct?


I must admit my cognition of content headers is lacking. Thanks for sharing your list.

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

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


The problem is that Windows desktop market share is overwhelming and as a Website writer, you take to think in Windows user terms!

Firefox quirk

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

I beg to differ. This is not a "quirk" and Chrome does non 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 accept limitations with regard to what punctuation is supported in file names, and user agents are _likely_ to conform file names accordingly." [ane] (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 merely reason a browser should consider doing any kind of change -- co-ordinate to the spec -- is if the underlying Os cannot handle a filename's syntax. I don't know if Windows all the same does that only e.g. DOS used to have a restriction that filesnames must be at most 8 characters, and finish in a dot followed by a three alphabetic character extension. Unix-derived operating system practice not have the organization, so if the OP is running on, say, on a Mac, in that location'south no reason for Firefox to fiddle with the filename. Information technology conforms to the standard.

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

[1] http://www.w3.org/html/wg/drafts/html/master/links.html#attr...

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

The customer-side solution sounds nice, just in that location's still likely a large percentage of your users for whom it won't work.

Then instead of simply a server-side solution, to practise this nicely you take to accept BOTH a server-side and client-side solution, for now. How is that proficient?

I suppose you could leave the default & quondam browser users to fend for themselves (in a manner of speaking), but sadly the folks who are downloading a dissimilar browser are more often than not the same folks who sympathize how to right-click.

The ones that demand a simple download link are the ones withal using their default browser.

How would a web designer exist able to cull my intention prematurely without a crystal ball?

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


Right click and salve-equally might be abrasive but it'due south 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 equally "permissible" past the author. This is a step in that management.

Settle downwards, no one'south taking your right-click away. The author is just conveying that this is a bad default to force on users for the elementary human action of downloading.

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

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

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

If my browser can't handle pdfs, information technology volition be forced to download them anyway.

If my browser can handle pdfs, but I want to salve it/view it with some other program, I can apply correct-click+save as.

Past contrast, a pdf which I want to view in-browser, just which forces the browser to download it instead is just a nuisance. Even if at that place 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 spider web, I decide how I view information technology. Effort to strength my paw and yous'll just annoy me into going elsewhere.

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

"There are or class other means of forcing file downloads, such equally adding certain configuration to your .htaccess file, but I remember server-side solutions to front-finish issues should be avoided whenever possible."

WOW. And so http have the solution for that, but equally you lot are lazy, you want to reinvent the bike and practice 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 yous mention a way to configure apache).

Yous give a service to the client, not but 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 whatever interest on learning it, you want the world to change to your needs. Isn't it?


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

The PDF instance is no problem with the builtin PDF back up in Chrome and Firefox. Or if you similar the Adobe stuff, just disable the plugin and y'all'll automatically get the download and then a prompt to launch Acrobat Reader.

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

QWERTY keyboards demand to become away, but they are design patterns that people are used to.

Whatever file the browser would ordinarily try to brandish natively or through a plugin tin can exist forced to download using this aspect.

What if you want to exercise the opposite? Are nosotros going to have to do "Right+click and Open in Browser"? What most mobile? Also, equally far as I'g aware this result is only actually with PDF files, as nearly every other MIME extension is not supported by a browser.

> Also, as far equally I'm aware this issue is just actually with PDF files, as nigh every other MIME extension is not supported by a browser.

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

off-topic, but got to say information technology:

> lots of people are literally agape of the right mouse push button

...c'mon, when will people grow out of this? and past people I mean GUI designers! One of the reasons I detest 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 fifty-fifty accept the options I care well-nigh) to change settings, I merely want to go effectually and right click on things I desire 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 decorated 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 quondam-school Microsoft UI design guys got right, but nobody gets information technology present! (information technology can also exist long-tap on touch on screens or ctr-click on macs, just you need a universally known way of showing a carte connected to whatsoever UI chemical element, a bill of fare that too includes a shortcut to the particular preferences for information technology)

I call back mayhap there is an increasing tendency to pattern 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 impact screen, and so often the desktop version of a program available for touch-screen devices won't make good apply of right-click either.

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

and again... no IE.

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

admittedly off-topic and yep a bit unreasonable, but after years of webdevelopment, i'g 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 look corporations or consumers to go along in-business firm browsers up-to-date, but actually: its a microsoft failure. Is it really _that_ hard to keep upwardly with the competition?


Take a lesson from the user backlash that happens every time a browser removes a feature: Don't do that. The all-time you can practise is encourage developers to apply an alternative. The worst you can practice is to strength it on people who don't share your betoken of view.


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

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

At that place's nothing in there well-nigh disabling Salve-As.


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

Sure fine, as long as there's a "launch handler anyway" context menu choice. I don't care what people recollect they need to say equally long as I have a way of doing the things I want to exercise anyway.

Case in point: If I want to save a PDF I usually save information technology from inside Okular. If Okular crashes while handling the PDF for display it'southward useless to me anyhow.

I don't hold with the last point, "In that location are or course other ways of forcing file downloads, such as adding certain configuration to your .htaccess file, but I call back server-side solutions to front-terminate problems should be avoided whenever possible."

If we are trying to Forcefulness 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 near taking away the user'south choice ... and so a server-side solution seems more reasonable per @jrochkind1.


I similar this except for the final part where he mentions that he doesn't like server-side solutions to front-end issues. The way I see information technology, this is a server-side problem that only shows up on the front cease. If we're talking about sending headers that tell the client to download something then that should exist coming from the server. Now, information technology's awesomely convenient that HTML5 lets us practise this but still, I see it every bit something that withal "belongs" on the server side. Just my take on that last role.

Yuck, browser specific things? What about the browsers y'all didn't mention? I would prefer there to exist i standard mode, not complicated tricks to be fix upwards for each browser.

My GF as well hates to download files for viewing. Why I have to download this video, pdf, audio file, why I tin't simply employ information technology in the browser. I simply desire to run across the content, not to save the file permanenty on reckoner.

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 instance this would lead to `download="download"` as if the suggested filename is "download", not "apply the filename establish in the URL".


I was hoping that at least IE eight would support a customer side prepare for this, merely hey who would always assume that IE would support something.

"Correct click and salve equally" is the last affair to go away imo.

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

But over again, that's simply me. :)

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

I retrieve the quirk is the other style effectually. I always dislike it when Chrome of a sudden decices to add together a ".txt" extension to the file I've just downloaded. It quondam even does this .js files.


If the files were beingness served with a text/plain MIME blazon, it's sensible beliefs for Chrome to add together .txt, and it's the site's error for sending the wrong type info.


What's really annoying to me is when links showtime downloading instead of opening the file in the browser. Is in that location whatsoever way to force Chrome to open a certain link, the way you tin can strength it to download via "save as"?

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

I dunno how I feel well-nigh forcing a download without a scrap more clarity to the user.


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


Let'due south say that gets adopted everywhere. For people like me who are used to doing RC/SA, you'll accept to put a "No Demand To RC/SA" prompt. You can't win.


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

No.

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


I think nosotros decided the whole "open in a new window" thing is annoying? Why non but leave the decision to the users to decide?


I certainly do -- I virtually ever want to change the file name to something that makes sense at my stop. I don't often care what makes sense at the creator's end; I desire to observe the file quickly when I demand it.

I do! Why?

* I just want to salve the file, not view/open information technology.

* I can quickly determine where I desire a file to exist saved.

* I tin can rename the file instantly.

* Some files are huge, and then I rather save than view.

* Bulk-Downloading many files at in one case.

Just because you don't need information technology in your daily work flow doesn't brand information technology obsolete for everyone else.


I do. I salve files in the right place as soon as they are downloaded: that way you never have a messy Downloads folder or a crowded desktop.


Well, when all browsers back up the HTML 5 download features then maybe the 'Correct click and salvage equally' tin go away. Until then it stays.

mcgheeexpont.blogspot.com

Source: https://news.ycombinator.com/item?id=5594791

Post a Comment for "Sorry Were Having Trouble Opening This Item This Could Be Temporary but if You See It Again You"