PDFs are opening in browser AND downloading
In my Firefox settings, I have PDF files set to "Open in Firefox".
When I click on a PDF file, Firefox DOES open the PDF in a new browser tab, but the PDF ALSO downloads to my desktop (both!). How can I stop it from downloading?
Diubah
Penyelesaian terpilih
If you don't want the PDF in your Temp folder, either, Firefox 103 added a new option to store it in the browser cache.
(3) New Content-Disposition Override
When a server sends a PDF, it can optionally send a Content-Disposition header (MDN). This header can indicate either "inline" or "attachment".
- "inline" refers to displaying in the browser
- "attachment" refers to downloading
This is invisible to you but explains why some PDFs open normally with their web address (inline) and some save to disk and open in a new tab with a file:/// address (attachment) after being saved to disk.
GOOD NEWS: Firefox 103 now has a new feature to override Content-Disposition: attachment for PDFs, making Firefox treat them all as web content (inline). If you prefer to use Firefox as your PDF viewer, then this should be helpful:
(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
(c) Double-click the preference to switch the value from false to true
Success?
Baca jawapan ini dalam konteks 👍 2All Replies (3)
PDF files need to be downloaded for Firefox to be able to read them for the PDF viewer.
Firefox 98 made a lot of changes to how PDFs open. The two big ones are:
(1) Skipping the download dialog
Firefox 97 and earlier would present a download dialog if the server tried to bypass the viewer by forcing a download (Content-Disposition: attachment). If you have "Open in Firefox", Firefox now skips the dialog and behaves as though you had clicked "Open with Firefox" in that dialog. In other words, it saves the file to disk and then opens it.
(2) Saving files in the "Save files to" folder instead of your Windows Temp folder
Firefox 98 changed from saving downloads in the Windows Temp folder for "Open with [relevant application]" or "Use [relevant application]" to saving them in your default downloads folder (the one next to "Save files to" on the Settings page). It's not possible to pass a file to an application without saving it somewhere.
Firefox 102 added a hidden setting to roll back that change. 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
(c) Double-click the preference to switch the value from false to true
Penyelesaian Terpilih
If you don't want the PDF in your Temp folder, either, Firefox 103 added a new option to store it in the browser cache.
(3) New Content-Disposition Override
When a server sends a PDF, it can optionally send a Content-Disposition header (MDN). This header can indicate either "inline" or "attachment".
- "inline" refers to displaying in the browser
- "attachment" refers to downloading
This is invisible to you but explains why some PDFs open normally with their web address (inline) and some save to disk and open in a new tab with a file:/// address (attachment) after being saved to disk.
GOOD NEWS: Firefox 103 now has a new feature to override Content-Disposition: attachment for PDFs, making Firefox treat them all as web content (inline). If you prefer to use Firefox as your PDF viewer, then this should be helpful:
(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
(c) Double-click the preference to switch the value from false to true
Success?