Downloading a PDF opens Firefox PDF Viewer instead of just downloading it
Categories
(Firefox :: File Handling, defect)
Tracking
()
People
(Reporter: morpheus0x, Unassigned)
References
Details
Attachments
(1 file)
1.35 MB,
video/webm
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0
Steps to reproduce:
This Bug was introduced in version 98.0 and still persists in current nightly build 107.0a1. This was tested in Fedora 36 with multiple Firefox Versions always with a clean profile with default settings.
Open Firefox and go to https://sogo-demo.de/SOGo/ (that was the easiest way for me to compare PDF preview and download behavior).
Login using the demo credentials.
Go to the 'Drafts' folder, the latest draft includes a PDF attachment.
There you can click on View Attachment
and Save Attachment
.
Actual results:
'View Attachment' works as intended, a new tab is opened containing the PDF in the default Firefox PDF Viewer.
However, clicking on 'Save Attachment', instantly starts downloading the PDF (disregarding the 'Always ask you where to save files' option) and opening the Firefox PDF Viewer.
Expected results:
'Save Attachment' should just download the PDF file as it would with any other file type, and it shouldn't show the PDF Viewer.
Reporter | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Downloads Panel' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Reporter | ||
Updated•3 years ago
|
Comment 2•3 years ago
|
||
Hello Morphews0x! Thank you for submitting this issue I have tried to reproduce the issue with firefox 108.0a1(2022-10-21) on Ubuntu 22.04, I think this is an intended behavior.
However you can change this behavior from about:preferences and under the Donwloads section you can change how Firefox behaves with the PDF files, the default behavior on Nightly is open in Nightly but you can change it to always ask.
Does this info help you with your issue?
Reporter | ||
Comment 3•3 years ago
|
||
I am aware of the Applications settings in Firefox. However, setting PDF to "Save To" will result in any embedded PDF being downloaded. This includes clicking view PDF in my sogo mail example.
I don't think that it is or should be intended behavior for Firefox to immediately open a downloaded PDF. Firefox should behave exactly as it did prior to version 98.0
Comment 4•3 years ago
|
||
Thank you for the reply Marco can you please take a look on this issue and provide an insight?
Comment 5•3 years ago
|
||
Gijs, IIRC we already had this on file and decided to WONTFIX as it is intended behavior, right?
Comment 6•3 years ago
•
|
||
Marco is correct. People previously complained (in fact, the most-duped open Firefox bug in bugzilla at one point!) that Firefox didn't honour the "always open [X] with [application]" setting for files sent by the server in a certain way - bug 453455. Now we do. One of the side effects is that if PDFs are set to open with Firefox, we will open the PDF even if the server says "you should download this PDF", because people indicated that Firefox should always do what they told Firefox to do (which seemed reasonable). For a few releases we would even open the PDF without first downloading it, but we had to turn that off (bug 1772569) because it made it harder for people to open the same files with other applications or store them somewhere permanently.
Reporter | ||
Comment 7•3 years ago
|
||
I don't want to be annoying, but I don't think the current behavior of Firefox provides the best user experience. Currently, Firefox doesn't honor intended behaviors of a website. If the server specifies how a file should be handled, the Browser should by default respect that (e.g. View or Download PDF).
I understand that when Firefox is set to always handle a specific file type in a certain way, it should always act accordingly. Therefore, I would propose the following changes:
Restore Firefox to how PDF were handled previously and instead
a. add a setting called, for example, "Force PDF to always perform selected Action". If enabled would result in current default behavior.
b. or split the current PDF Content Type into "View Portable Document Format (PDF)" and "Download Portable Document Format (PDF)"
There is no way to restore previous Firefox behavior, even with Enterprise Policies. I opened a related GitHub issue here: https://github.com/mozilla/policy-templates/issues/961
PDFs are a special case, since may people use Firefox as their PDF Viewer, but sometimes a PDF should just be downloaded (e.g. saving an important document). The current behavior for downloading a PDF with the "Open in Firefox" Action set is to disregard the "Always ask you where to save files" setting, instantly download the PDF into the default Downloads folder and opening it. This would be a bug on its own...
Reporter | ||
Comment 8•3 years ago
|
||
Please reopen this issue
Comment 10•3 years ago
|
||
I want to stress that I don't think that the current behavior of Firefox works as intended. Especially since having 'Open in Firefox' set for PDFs will disregard the 'Always ask you where to save files' for downloading a PDF.
This too was an explicit user request - bug 1738916.
Furthermore, this disregards intended behavior of websites that serve a PDF file to be specifically downloaded (see example of original bug report below).
The file is still downloaded, it is just also opened.
If the server specifies how a file should be handled, the Browser should by default respect that (e.g. View or Download PDF).
This is precisely the opposite of the many-many-times requested behaviour that we should do what the user wants rather than the website owner, in bug 453455. Random sample:
Programmers of FireFox should finally do something about this. Since years during each download I am offered this checkbox "Do this automatically for files like this from now on." and never, ever is anything done in the way as my checked checkbox would indicate.
Before these changes, we would have prompted you what to do in this case (which is also not really doing what the website asks straight away!).
a. add a setting called, for example, "Force PDF to always perform selected Action". If enabled would result in current default behavior.
"No I really mean it" as a checkbox setting seems... not the best UI. No other browser, AFAICT, has UI for these kinds of things - the choice is either to use the builtin PDF viewer or not to use it.
I discussed this with a product manager and right now we don't think that it's worth adding yet more complexity to PDF handling in order to address the usecase where the opening of the tab in and of itself is somehow problematic for the user.
If this case is sufficiently common for you, you can set PDFs to "always ask me what to do with this file".
Reporter | ||
Comment 11•3 years ago
|
||
Thank you for your lengthy reply. It is very unfortunate that I seem to be in the minority of users who don't find the current behavior an improvement. And I understand that it is probably annoying to have a newly added, highly requested user feature to be questioned by a user again.
If this case is sufficiently common for you, you can set PDFs to "always ask me what to do with this file".
Setting this will break embedded PDFs that use the Firefox PDF Viewer and also results in one more click, which is what users have complained about before and I also find annoying.
"No I really mean it" as a checkbox setting seems... not the best UI. No other browser, AFAICT, has UI for these kinds of things - the choice is either to use the builtin PDF viewer or not to use it.
Yes, maybe this isn't the best option. How about just adding the option to about:config, since apparently my wanted behavior isn't that popular anyway?
For example: browser.download.disregard_pdf_content_type
defaults to true and if set to false restores the previous behavior.
Or: browser.download.respect_pdf_content_type
defaulting to false ...
I am uncertain if there are any guidelines on how to call these settings, what default value is preferred or what case to use (there are both camel case and snake case options).
Comment 12•3 years ago
|
||
(In reply to Morpheus0x from comment #11)
If the location of the downloaded file is the main issue for you (rather than the opened tab), then the other option I can suggest is turning on browser.download.open_pdf_attachments_inline
in about:config - then all PDFs will open inline without downloading, and you can choose where to save when using the "save as" button in the PDF viewer.
"No I really mean it" as a checkbox setting seems... not the best UI. No other browser, AFAICT, has UI for these kinds of things - the choice is either to use the builtin PDF viewer or not to use it.
Yes, maybe this isn't the best option. How about just
I think you probably underestimate the amount of work it would take to create yet another option and have it work reliably (given it has to work with blobs, with various mimetypes, do the right thing when clicking links to other PDFs that are already open in the viewer, work with all the other options we already have, etc. etc., and we'd have to keep that all working in perpetuity)...
adding the option to about:config, since apparently my wanted behavior isn't that popular anyway?
This isn't discoverable and would probably mean almost nobody else finds out it exists, further diminishing the value of the work and making the effort/reward balance of doing it even worse. This is part of why this isn't a good investment for Mozilla right now.
We've previously used telemetry on some options like this, that were publicized exclusively through people offering negative feedback about new features on reddit or the like, and the absolute numbers of people using them (even when publicized through angry redditors!) are tiny.
For example:
browser.download.disregard_pdf_content_type
defaults to true and if set to false restores the previous behavior.
Or:browser.download.respect_pdf_content_type
defaulting to false ...
I am uncertain if there are any guidelines on how to call these settings, what default value is preferred or what case to use (there are both camel case and snake case options).
Yeah, prefs are a mess, unfortunately - that's what 20 years of history with no enforcement of (and differences of opinions on) styles gets you. We're slowly getting better at this kind of thing.
For now, I think this bug is staying closed. If we see many (no, the reddit thread on this topic doesn't count as many :-) ) other people requesting the same behaviour, we can reconsider if there is some kind of UX that would make the behaviour more intuitive for more users. But as it is, there is a disconnect between the web primitives (which are roughly "here's a file" and "here's a file with a filename, that maybe you shouldn't try to show inline"), and user primitives ("files of type X should be shown/downloaded/opened"). Made worse by the fact that the web primitives have both new forms (<a href="..." download="...">
) and old ones (Content-Disposition: attachment
) where the old ones aren't necessarily very indicative of even web author intent - just what php/python/perl/java/apache/whatever do by default with non-HTML files. The browser can't reliably tell if that url you just loaded that said "I'm a download" had a clear "download" expectation when you clicked it (and perhaps an alternative link to the same file without the download expectation, because the website is trying to be helpful!) or if it's just an inconsiderate server that sends that header for every file (still something plenty of places do).
Reporter | ||
Comment 13•3 years ago
|
||
(In reply to :Gijs (he/him) from comment #12)
Thank you for that detailed explanation. I wasn't aware of the implications of adding a new setting, and completely understand implementing a feature that is very rarely used isn't a good investment of developer time.
Therefore, I will look into writing an extension for Firefox that restores my desired behavior. I have always wanted to write my own extension and this is a good reason to start. Please let me know if you have any pointers on how to achieve this.
If the location of the downloaded file is the main issue for you (rather than the opened tab), then the other option I can suggest is turning on browser.download.open_pdf_attachments_inline in about:config - then all PDFs will open inline without downloading, and you can choose where to save when using the "save as" button in the PDF viewer.
I probably will use this for now as a workaround.
For now, I think this bug is staying closed. If we see many (no, the reddit thread on this topic doesn't count as many :-) ) other people requesting the same behaviour, we can reconsider
I wasn't aware of any Reddit thread and think I found the one you are referencing. Thank you, I will announce my extension there, once it's ready.
Reporter | ||
Comment 14•3 years ago
|
||
I wrote the extension over the last couple of days, and it almost perfectly restores my intended behavior. The only issue is with downloads directly from storage via blob, since those downloads don't produce a http request that can be intercepted.
https://addons.mozilla.org/en-US/firefox/addon/prevent-pdf-viewer-on-download/
Description
•