搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

.pdf is always opening as a download and file in new version Windows 10, 104

  • 6 回覆
  • 0 有這個問題
  • 264 次檢視
  • 最近回覆由 mavoga

more options

Hi! In Windows 10 new version 104, .pdf are opening as a download as well as a file. I checked settings, and it still shows that .pdf should open as a file. How do I keep it from becoming a download?

See image to see what is happening. This did not happen with any of the older versions.

Thank you so very much for your help!! T.S.

Hi! In Windows 10 new version 104, .pdf are opening as a download as well as a file. I checked settings, and it still shows that .pdf should open as a file. How do I keep it from becoming a download? See image to see what is happening. This did not happen with any of the older versions. Thank you so very much for your help!! T.S.
附加的畫面擷圖

被選擇的解決方法

Hi Jscher! Thank you for the instructions. Will following these instructions make it so that my Quicken data does not download from my bank?? It forces it to download, whereas these other websites are not forcing it to download.

The other problem is that I'm trying to get a link to share with others of that flyer. It is showing up as a file:/// instead of an https://. That link cannot be opened by other people. Will making this change solve that problem?

Is there any way to notify Mozilla that they have inadvertently made this change in 104, and it is causing problems?

I greatly appreciate your help... Thank you!

- ToSt

從原來的回覆中察看解決方案 👍 0

所有回覆 (6)

more options

Firefox needs to download the file to be able to read it for the PDF Viewer. Here's some more information which may help prevent having to deal with an "extra" file -

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

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.

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

more options

Sorry this is long, but you have options.

Let's assume your have kept the standard setting of "Open in Firefox" for PDF files on the Settings page. (View PDF files in Firefox or choose another viewer)

Background: inline vs. attachment disposition

If web servers don't specify how Firefox should handle a PDF, or specify "inline" handling, then then Firefox loads the PDF as web content with its original URL in the address bar. The PDFs are saved with other cached web content, not in your download folder.

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.

New options for saving downloads

In response to user suggestions/complaints, Mozilla added some options to modify the above:

(1) Just for PDFs, override "attachment" disposition to "inline"

All PDFs will 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 and opens automatically, change from the "Save files to" folder to the Windows Temp folder

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 the way you want.

more options

選擇的解決方法

Hi Jscher! Thank you for the instructions. Will following these instructions make it so that my Quicken data does not download from my bank?? It forces it to download, whereas these other websites are not forcing it to download.

The other problem is that I'm trying to get a link to share with others of that flyer. It is showing up as a file:/// instead of an https://. That link cannot be opened by other people. Will making this change solve that problem?

Is there any way to notify Mozilla that they have inadvertently made this change in 104, and it is causing problems?

I greatly appreciate your help... Thank you!

- ToSt

more options

Hi ToSt, the change between inline and attachment is only for PDFs. Your bank probably provides either CSV or QIF or XLS files for data, not PDFs.

Regarding sharing, the change will help going forward. For files you already downloaded, you would need to look up the original web address a different way: open the Downloads list -- either using the toolbar button or Ctrl+J -- right-click the download and then use Copy Download Link. Then you can paste that into an email or message to share it.

more options

Hi! You're right. The bank is .QIF. I did what you said and now it works! I don't know what all the other people using Firefox will do. I hope they change it back to using the defaults.

I'm a volunteer for National Wildlife Federation and the link will go in a newsletter that is read by 6,000 people.

Thanks so very much for your volunteering!! You make a difference!! - ToSt

more options

These changes on PDF handling are causing me lots of headaches.

Till v97 the content-disposition header was respected and when set to "attachment" appeared, just as expected, a box to choose the action; it was possible to download the file, to open it with an external application, it was also possible to view the document within the browser itself.

Since v98 for PDF files the content-disposition header is partially ignored: every document is open inline and if the setting browser.download.open_pdf_attachments_inline is set to false (the default) when the content-disposition is set to attachment the file is automatically saved to the default download folder (which obviously is not the position where I want to store the file).

To make matters worse, when setting browser.download.open_pdf_attachments_inline and trying to save the document, the smart association between sites and download directory doesn't work.

Dear Mozilla, couldn't you simply let things as they were?!? The former behavior respected the RFCs, while the current doesn't. If you wanted to give a further possibility to users you could add a preference, while forcing all users to an absurd behaviour is definitely unfair.

由 mavoga 於 修改