![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
Firefox is spawning a million dialog boxes when I try to download a PDF
I have had a really consistent experience on Firefox for Ubuntu (120.0 (64-bit)):
- I open a google doc and choose "Download > PDF"
- Google Docs pops the PDF open in a new tab. The location is my own file system, eg. `file:///home/amanda/Downloads/whatever.docx.pdf`
- I use ctrl-s to save the PDF to a more suitable folder
- Firefox starts spawning dialog boxes. The black border around the dialog box just grows for a while. I can't even tell if clicking "cancel" is actually doing anything because maybe it is closing the dialog and revealing the one below.
- The only solution is to quit Firefox entirely.
It seems to also happen if I print from Google Docs or just use the finder to open a PDF directly in Firefox: using ctrl-s to save starts it spawning infinite "Save" dialogs.
Obviously, I can avoid this by using the OS file manager to move the PDF to a more suitable location but it would be really nice to not have to keep track of that.
Toutes les réponses (2)
You get tabs opening endlessly if you select Firefox as the application to handle a file when you get an "Open with" dialog.
You will have to remove this action.
- Settings -> General -> Applications
- https://support.mozilla.org/en-US/kb/change-firefox-behavior-when-open-file
That's very strange!
As a faster way to get to your downloaded file, try this:
- Click the Downloads arrow on the toolbar to drop the recent downloads list
- Click the folder icon on the right side of the relevant PDF to launch your system file browser -- the target file should be selected
- Move the file and close the system file browser window
You also can redirect auto-downloaded PDFs to be stored differently, although I don't know whether that will help with the duplicating dialog problem. A little background is needed:
Background: inline vs. attachment disposition
If web servers don't specify how Firefox should handle a PDF, or if they specify "inline" handling, then then Firefox loads the PDF as web content with its original http or https URL in the address bar. The PDFs are saved with other cached web content, not in your download folder. This is good.
But web servers can try to force a download by setting Content-Disposition: attachment if they don't want browsers to show the files in a tab. Firefox changed what it does in this case:
Before Firefox 98: Firefox always showed a download dialog, even though you had already told Firefox what you wanted to do, even when you checked the box to always do this in the future. It was kind of infuriating.
Firefox 98+: Firefox downloads the file automatically and then opens it. Because these are saved to disk the URLs start with file:///. By default, they are saved in your "Save files to" folder on the Settings page. These are the ones creating the problem.
Alternate options for saving downloads
(1) For PDFs, you can override "attachment" disposition to "inline"
When your handling action is "Open in Firefox", all PDFs can now be opened as web content and saved in the cache instead of a regular folder. Here's how you set this up:
(a) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future. I'm using this so I feel comfortable mentioning it.
(b) In the search box in the page, type or paste browser.download.open_pdf_attachments_inline and pause while the list is filtered -- requires Firefox 103 or later
(c) Double-click the preference to switch the value from false to true
(2) For all the downloads Firefox saves to disk and opens automatically, you can change from the "Save files to" folder to the system /tmp folder (if you made the change in #1, this will affect other kinds of files rather than PDFs)
Here's how you access it:
(a) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future.
(b) In the search box in the page, type or paste browser.download.start_downloads_in_tmp_dir and pause while the list is filtered -- requires Firefox 102 or later
(c) Double-click the preference to switch the value from false to true
This would not affect files opened with inline disposition; those will still be in the web content cache.
Hopefully some of that gets Firefox working with your OS.